Download app.py from Bagda/IMAGEIN: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/spaces/Bagda/IMAGEIN/resolve/main/app.py
- Command line
-
hf download hf://spaces/Bagda/IMAGEIN/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Bagda/IMAGEIN/resolve/main/app.py
1.13 kB
| import gradio as gr | |
| # यहाँ आप अपने AI मॉडल या API को कॉल करें | |
| def respond_to_message(message, chat_history): | |
| # सरल उदाहरण: यूजर मैसेज को एआई की तरह जवाब देता है | |
| bot_message = f"AI: आपने पूछा: {message}" | |
| chat_history.append((message, bot_message)) | |
| return "", chat_history | |
| with gr.Blocks() as demo: | |
| chatbot = gr.Chatbot(label="AI चैट बोर्ड") | |
| msg = gr.Textbox(label="आपका मैसेज") | |
| clear = gr.ClearButton([msg, chatbot]) | |
| msg.submit(respond_to_message, [msg, chatbot], [msg, chatbot]) | |
| demo.launch() | |
| import openai | |
| # OpenAI के लिए (उदाहरण) | |
| openai.api_key = "YOUR_API_KEY" | |
| def respond_to_message(message, chat_history): | |
| response = openai.ChatCompletion.create( | |
| model="gpt-3.5-turbo", | |
| messages=[{"role": "user", "content": message}] | |
| ) | |
| bot_message = response.choices[0].message['content'] | |
| chat_history.append((message, bot_message)) | |
| return "", chat_history | |