Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Charger le modèle Bio-Medical-Llama-3-8B
|
5 |
+
model = pipeline("text-generation", model="ContactDoctor/Bio-Medical-Llama-3-8B")
|
6 |
+
|
7 |
+
# Définir la fonction de génération de texte
|
8 |
+
def generate_text(prompt):
|
9 |
+
response = model(prompt, max_length=100)
|
10 |
+
return response[0]["generated_text"]
|
11 |
+
|
12 |
+
# Créer l'interface Gradio
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=generate_text,
|
15 |
+
inputs="text",
|
16 |
+
outputs="text",
|
17 |
+
title="Medi-Trust API",
|
18 |
+
description="Générez des réponses médicales à partir de déclarations."
|
19 |
+
)
|
20 |
+
|
21 |
+
# Lancer l'application
|
22 |
+
iface.launch()
|