Spaces:
Runtime error
Runtime error
Quentin GALLOUÉDEC
commited on
Commit
•
4afacff
1
Parent(s):
511b703
jat
Browse files
app.py
CHANGED
@@ -5,14 +5,14 @@ from transformers import pipeline
|
|
5 |
|
6 |
# Get the list of models from the Hugging Face Hub
|
7 |
api = HfApi()
|
8 |
-
models = api.list_models(author="
|
9 |
models_names = [model.modelId for model in models]
|
10 |
|
11 |
# Dictionary to store loaded models and their pipelines
|
12 |
model_pipelines = {}
|
13 |
|
14 |
# Load a default model initially
|
15 |
-
default_model_name = "
|
16 |
|
17 |
|
18 |
def generate_text(model_name, input_text):
|
@@ -42,11 +42,11 @@ def generate_text(model_name, input_text):
|
|
42 |
iface = gr.Interface(
|
43 |
fn=generate_text, # Function to be called on user input
|
44 |
inputs=[
|
45 |
-
Dropdown(models_names, label="Select Model", value=
|
46 |
Textbox(lines=5, label="Input Text"), # Textbox for entering text
|
47 |
],
|
48 |
outputs=Textbox(label="Generated Text"), # Textbox to display the generated text
|
49 |
-
title="
|
50 |
)
|
51 |
|
52 |
# Launch the Gradio interface
|
|
|
5 |
|
6 |
# Get the list of models from the Hugging Face Hub
|
7 |
api = HfApi()
|
8 |
+
models = api.list_models(author="jat-project", filter=ModelFilter(tags="text-generation"))
|
9 |
models_names = [model.modelId for model in models]
|
10 |
|
11 |
# Dictionary to store loaded models and their pipelines
|
12 |
model_pipelines = {}
|
13 |
|
14 |
# Load a default model initially
|
15 |
+
default_model_name = "jat-project/jat-small"
|
16 |
|
17 |
|
18 |
def generate_text(model_name, input_text):
|
|
|
42 |
iface = gr.Interface(
|
43 |
fn=generate_text, # Function to be called on user input
|
44 |
inputs=[
|
45 |
+
Dropdown(models_names, label="Select Model", value=default_model_name), # Select model
|
46 |
Textbox(lines=5, label="Input Text"), # Textbox for entering text
|
47 |
],
|
48 |
outputs=Textbox(label="Generated Text"), # Textbox to display the generated text
|
49 |
+
title="JAT Text Generation", # Title of the interface
|
50 |
)
|
51 |
|
52 |
# Launch the Gradio interface
|