Bman21 commited on
Commit
fec4f5a
·
verified ·
1 Parent(s): e01ce0b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from huggingface_hub import InferenceClient
3
+
4
+ MODEL = "epfl-llm/meditron-7b"
5
+
6
+ def chat(message, history, hf_token):
7
+ if not hf_token: return "Please log in"
8
+
9
+ client = InferenceClient(token=hf_token.token, model=MODEL)
10
+ response = client.text_generation(f"Medical tutor: {message}", max_new_tokens=150)
11
+ return response
12
+
13
+ gr.ChatInterface(
14
+ chat,
15
+ title="🩺 Medical Tutor",
16
+ examples=["Explain how vaccines work", "What is DNA?"]
17
+ ).launch(server_port=7860)