Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -105,7 +105,7 @@ def check_and_load_model(model_name):
|
|
105 |
return llm
|
106 |
|
107 |
# Interface Gradio
|
108 |
-
def gradio_interface(model_name, input, max_tokens, temperature, history
|
109 |
global stop_flag
|
110 |
stop_flag = False
|
111 |
response = None # Initialisez la variable response ici
|
@@ -120,7 +120,8 @@ def gradio_interface(model_name, input, max_tokens, temperature, history, stop_b
|
|
120 |
thread.join()
|
121 |
|
122 |
if stop_flag:
|
123 |
-
|
|
|
124 |
else:
|
125 |
history.append((input, response))
|
126 |
return response, history # Maintenant, response est accessible ici
|
@@ -134,11 +135,11 @@ demo = gr.Interface(
|
|
134 |
gr.Textbox(label="Input"),
|
135 |
gr.Slider(minimum=1, maximum=2048, step=1, label="Max Tokens", value=256),
|
136 |
gr.Slider(minimum=0.0, maximum=1.0, step=0.1, label="Temperature", value=0.7),
|
137 |
-
gr.
|
138 |
],
|
139 |
outputs=[
|
140 |
gr.Textbox(label="Output"),
|
141 |
-
gr.State(
|
142 |
],
|
143 |
title="Ollama Demo",
|
144 |
description="""
|
@@ -147,7 +148,6 @@ demo = gr.Interface(
|
|
147 |
Cette Démo permet aux utilisateurs de tester tous les modèles Ollama dont la taille est inférieure à 10 milliards de paramètres directement depuis cette interface.
|
148 |
|
149 |
L'Application tourne sur une machine Hugging Face Free Space : 2 CPU - 16Gb RAM
|
150 |
-
|
151 |
Soyez patient...
|
152 |
"""
|
153 |
)
|
|
|
105 |
return llm
|
106 |
|
107 |
# Interface Gradio
|
108 |
+
def gradio_interface(model_name, input, max_tokens, temperature, history):
|
109 |
global stop_flag
|
110 |
stop_flag = False
|
111 |
response = None # Initialisez la variable response ici
|
|
|
120 |
thread.join()
|
121 |
|
122 |
if stop_flag:
|
123 |
+
history.append((input, "Processing stopped by the user."))
|
124 |
+
return "Processing stopped by the user.", history
|
125 |
else:
|
126 |
history.append((input, response))
|
127 |
return response, history # Maintenant, response est accessible ici
|
|
|
135 |
gr.Textbox(label="Input"),
|
136 |
gr.Slider(minimum=1, maximum=2048, step=1, label="Max Tokens", value=256),
|
137 |
gr.Slider(minimum=0.0, maximum=1.0, step=0.1, label="Temperature", value=0.7),
|
138 |
+
gr.State(value=[]) # Ajout de l'historique
|
139 |
],
|
140 |
outputs=[
|
141 |
gr.Textbox(label="Output"),
|
142 |
+
gr.State() # Ajout de l'historique
|
143 |
],
|
144 |
title="Ollama Demo",
|
145 |
description="""
|
|
|
148 |
Cette Démo permet aux utilisateurs de tester tous les modèles Ollama dont la taille est inférieure à 10 milliards de paramètres directement depuis cette interface.
|
149 |
|
150 |
L'Application tourne sur une machine Hugging Face Free Space : 2 CPU - 16Gb RAM
|
|
|
151 |
Soyez patient...
|
152 |
"""
|
153 |
)
|