Download app.py from gj2233/ChatGPT: direct link, hf CLI and curl.
- Browser
- Download file 493 Bytes
-
https://huggingface.co/spaces/gj2233/ChatGPT/resolve/main/app.py
- Command line
-
hf download hf://spaces/gj2233/ChatGPT/app.py
-
curl -L -o app.py https://huggingface.co/spaces/gj2233/ChatGPT/resolve/main/app.py
493 Bytes
| from g4f.client import Client | |
| import gradio as gr | |
| client = Client() | |
| def chatbot_respone(user_input): | |
| response = client.chat.completions.create( | |
| model="gpt-4", | |
| messages=[{"role": "user", "content": user_input}] | |
| ) | |
| return response.choices[0].message.content | |
| interface = gr.Interface( | |
| fn=chatbot_respone, | |
| inputs= gr.Textbox(lines=2), | |
| outputs=["text"], | |
| title="AI power up" | |
| ) | |
| if __name__ =="__main__": | |
| interface.launch(share=True) | |