Spaces:
Sleeping
Sleeping
| import os | |
| from gradio_client import Client | |
| import gradio as gr | |
| HF_TOKEN = os.environ.get("HF_TOKEN") | |
| REPO_ID = os.environ.get("REPO_ID") | |
| client = Client(REPO_ID, hf_token=HF_TOKEN) | |
| def reply(ques, history): | |
| print(ques) | |
| result = client.predict( | |
| message=ques, | |
| api_name="/chat" | |
| ) | |
| return result | |
| with gr.Blocks(title="Madhuram Model Chat") as demo: | |
| with gr.Column(elem_id="main-container"): | |
| gr.Markdown("# Madhuram Chat Interface", elem_classes="center-text") | |
| chatbot = gr.ChatInterface( | |
| fn=reply, | |
| type="messages" | |
| ) | |
| gr.Markdown("*Disclaimer - This is a demo version of Madhuram. It may occasionally generate incorrect or incomplete responses. Please verify important information independently. The complete model will be available through our own playground where the missing features will be incorporated.*", elem_classes="disclaimer") | |
| demo.css = """ | |
| #main-container { | |
| max-width: 800px; | |
| margin: 0 auto; | |
| padding: 20px; | |
| } | |
| .center-text { | |
| text-align: center; | |
| } | |
| .disclaimer { | |
| text-align: center; | |
| color: #666; | |
| font-size: 0.9em; | |
| margin-bottom: 20px; | |
| } | |
| """ | |
| if __name__ == "__main__": | |
| demo.launch() |