Spaces:
Build error
Build error
Download app.py from ryanpereira/Project1: direct link, hf CLI and curl.
- Browser
- Download file 562 Bytes
-
https://huggingface.co/spaces/ryanpereira/Project1/resolve/main/app.py
- Command line
-
hf download hf://spaces/ryanpereira/Project1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ryanpereira/Project1/resolve/main/app.py
562 Bytes
| import gradio as gr | |
| import os | |
| from groq import Groq | |
| client = Groq( | |
| api_key=os.environ.get("GROQ_API_KEY"), | |
| ) | |
| def random_response(message, history): | |
| #Connect it with LLM | |
| chat_completion = client.chat.completions.create( | |
| messages=[ | |
| { | |
| "role": "user", | |
| "content": message, | |
| } | |
| ], | |
| model="meta-llama/llama-4-scout-17b-16e-instruct", | |
| ) | |
| return chat_completion.choices[0].message.content | |
| demo = gr.ChatInterface(random_response, type="messages", autofocus=False) | |
| if __name__ == "__main__": | |
| demo.launch() | |