Spaces:
Running
Not able to use autoquizzer
Hi,
I am trying to use the Autoquizer to explore my self but I am not sure how can I call from local machine to Spaces in Hugging Face. So I am trying to follow the steps which you described to run in local machine. But I am getting below error. Can you please help me to solve the issue or please let me know how can I call your Autoquizzer from Hugging Face in my local machine.
Error details:
Traceback (most recent call last):
File "C:\Users\Gebruiker\Heckthon\heckthon\backend\pipelines.py", line 43, in
OpenAIGenerator(
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\haystack\core\component\component.py", line 176, in call
instance = super().call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\haystack\components\generators\openai.py", line 100, in init
self.client = OpenAI(api_key=api_key.resolve_value(), organization=organization, base_url=api_base_url)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\haystack\utils\auth.py", line 201, in resolve_value
raise ValueError(f"None of the following authentication environment variables are set: {self._env_vars}")
ValueError: None of the following authentication environment variables are set: ('I used my GROQ_API_KEY:',).
Please note that I am new to the AI tools. Kindly help me to solve the issue
Hello!
As explained here, to run it locally, you will need to set 2 environment variables:
GROQ_API_KEY
: API key for the Groq API, used to serve Llama 3. (Currently, this API Key is free).SERPERDEV_API_KEY
: API key for the SerperDev API, used to fetch search results.
If you want to use a local model instead, you can replace the current generator with, for example, an OllamaGenerator
.
Thanks for quick response, can you please give more details how to set above environments because I have GroqAPI API Key but sure how to setup the environment.
You can edit the pipelines.py file as follows
import os
os.environ["GROQ_API_KEY"]="YOUR-KEY"
There are better and cleaner ways to set an environment variable, depending on your operating system.
Once again thanks, Problem is solved now, can I use same way to SERPERDEV_API_KEY,
os.environ["SERPERDEV_API_KEY"]="YOUR-KEY" ?
I tried the above method for both and I can see max is Zero I am going to run the app now and see how it works and Thanks for all your support, My I know your name?
I noticed that you have updated "backend/custom_components.py" and backend/pipelines.py files. I also adjusted the my code. Now I am receiving below error. Can you please help me? Few errors I corrected like(when pipeline name is existed we can't use same pipe line so I renamed it). But below error not able to find out what is issue.
Traceback (most recent call last):
File "C:\Users\Gebruiker\Heckthon\heckthon\app.py", line 206, in
fin.read()
File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 33: character maps to
Finlay I resolved the above issue but now I am getting below error.
Running on local URL: http://0.0.0.0:7860
To create a public link, set share=True
in launch()
Is this something you have to change from your end?
Finlay I resolved the above issue but now I am getting below error.
Running on local URL: http://0.0.0.0:7860
To create a public link, setshare=True
inlaunch()
Is this something you have to change from your end?
This is not an error but only a warning.
If you go to the local URL mentioned (http://0.0.0.0:7860), you should be able to play with the application.
Finally I am able to solve the issue, When I use http://127.0.0.1:7860 , I am able to lunch the app but when I am trying to use the app I am getting below error.
Traceback (most recent call last):
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\gradio\queueing.py", line 521, in process_events
response = await route_utils.call_process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\gradio\route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\gradio\blocks.py", line 1945, in process_api
result = await self.call_function(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\gradio\blocks.py", line 1513, in call_function
prediction = await anyio.to_thread.run_sync(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\anyio_backends_asyncio.py", line 2144, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\anyio_backends_asyncio.py", line 851, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Gebruiker\AppData\Local\JetBrains\PyCharmCE2024.1\demo\PyCharmLearningProject\venv\Lib\site-packages\gradio\utils.py", line 831, in wrapper
response = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "C:\Users\Gebruiker\Heckthon\heckthon\app.py", line 30, in populate_quiz
choices=quiz["questions"][i]["options"],
~~~~^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
It seems that the quiz was not generated correctly.
Did I miss anything I follow the steps and not added or modified. First would like to see the your app in my local run and then thought modify.