HotDrify / freeAI

this is a python package to use the completely free chatGPT and more models.
Apache License 2.0
20 stars 2 forks source link

Problem with module 'fake_useragent' #3

Open azarijafari opened 1 year ago

azarijafari commented 1 year ago

When I want to run code in google colab this error occurs: no module named 'fake_useragent' I installed the package by: !pip install fake_useragent but again faced with the error: no module named 'fake_useragent'

HotDrify commented 1 year ago

@azarijafari hello, try this: pip3 install fake-useragent

please put a star on the repository to promote the project<3

azarijafari commented 1 year ago

Sure. Putting star Done. :) But now this error occures: RuntimeError: This event loop is already running Can you execute a true code in google colab and share with me?

HotDrify commented 1 year ago

@azarijafari can you please send me the whole code of your google calab

azarijafari commented 1 year ago

Cell 1: !pip install fake_useragent Cell 2:

!git clone https://github.com/HotDrify/freeAI
%cd freeAI
!python3 setup.py install

Cell 3:

from freeAI import lockgpt
import asyncio

async def main():
    result = await lockgpt.Completion.acreate("Hello! what language model are you?")
    print(result)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

This cell face with an error.

HotDrify commented 1 year ago

@azarijafari cell 1: !pip install fake-useragent cell2 !pip install git+https://github.com/HotDrify/freeAI cell 3 from freeAI import lockgpt import asyncio

async def main(): result = await lockgpt.Completion.acreate("Hello! what language model are you?") print(result)

loop = asyncio.get_event_loop() loop.run_until_complete(main())

azarijafari commented 1 year ago

Again error in the last line: code: loop.run_until_complete(main()) error: RuntimeError: This event loop is already running

HotDrify commented 1 year ago

@azarijafari from freeAI import lockgpt import asyncio

async def main(): result = await lockgpt.Completion.acreate("Hello! what language model are you?") print(result)

if name == "main": asyncio.run(main())

try like this.

azarijafari commented 1 year ago

RuntimeError: asyncio.run() cannot be called from a running event loop

Devanaath commented 1 year ago

Man i get the same error when i try to run it on colab

Code:

!pip install git+https://github.com/HotDrify/freeAI

from freeAI import mishalsgpt
import asyncio

async def main():
    result = await mishalsgpt.Completion.acreate("Hello! what language model are you?")
    print(result)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-3-f15bcb9cdc12> in <cell line: 9>()
      7 
      8 loop = asyncio.get_event_loop()
----> 9 loop.run_until_complete(main())

1 frames
/usr/lib/python3.10/asyncio/base_events.py in run_until_complete(self, future)
    623         """
    624         self._check_closed()
--> 625         self._check_running()
    626 
    627         new_task = not futures.isfuture(future)

/usr/lib/python3.10/asyncio/base_events.py in _check_running(self)
    582     def _check_running(self):
    583         if self.is_running():
--> 584             raise RuntimeError('This event loop is already running')
    585         if events._get_running_loop() is not None:
    586             raise RuntimeError(

RuntimeError: This event loop is already running

Please help us out @HotDrify

HotDrify commented 1 year ago

@Devanaath the problem is most likely on the side of google calab

Devanaath commented 1 year ago

Ok @HotDrify, thanks for spending your time for me 😊

HotDrify commented 1 year ago

@Devanaath goodbye)