Spaces:
Running
Running
fix interface
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ from typing import Optional, Union
|
|
| 5 |
import gradio as gr
|
| 6 |
from huggingface_hub import HfApi, Repository
|
| 7 |
from export import convert
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
DATASET_REPO_URL = "https://huggingface.co/datasets/optimum/exporters"
|
|
@@ -88,7 +89,7 @@ This Space uses [Optimum Intel](https://huggingface.co/docs/optimum/intel/infere
|
|
| 88 |
|
| 89 |
To export your model you need:
|
| 90 |
- A read-access token from [https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens).
|
| 91 |
-
- A
|
| 92 |
|
| 93 |
|
| 94 |
That's it ! π₯
|
|
@@ -96,33 +97,30 @@ That's it ! π₯
|
|
| 96 |
After the model conversion, we will open a PR against the source repo.
|
| 97 |
"""
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
with gr.Blocks() as demo:
|
| 100 |
gr.HTML(TTILE_IMAGE)
|
| 101 |
gr.HTML(TITLE)
|
| 102 |
-
|
| 103 |
-
with gr.Row():
|
| 104 |
-
with gr.Column(scale=1):
|
| 105 |
-
gr.Markdown(DESCRIPTION)
|
| 106 |
-
|
| 107 |
-
with gr.Column(scale=1):
|
| 108 |
-
input_token = gr.Textbox(
|
| 109 |
-
max_lines=1,
|
| 110 |
-
label="Hugging Face token",
|
| 111 |
-
)
|
| 112 |
-
input_model = gr.Textbox(
|
| 113 |
-
max_lines=1,
|
| 114 |
-
label="Model name",
|
| 115 |
-
placeholder="distilbert-base-uncased-finetuned-sst-2-english",
|
| 116 |
-
)
|
| 117 |
-
|
| 118 |
-
btn = gr.Button("Export")
|
| 119 |
-
output = gr.Markdown(label="Output")
|
| 120 |
-
|
| 121 |
-
btn.click(
|
| 122 |
-
fn=export,
|
| 123 |
-
inputs=[input_token, input_model],
|
| 124 |
-
outputs=output,
|
| 125 |
-
)
|
| 126 |
-
|
| 127 |
|
| 128 |
demo.launch()
|
|
|
|
| 5 |
import gradio as gr
|
| 6 |
from huggingface_hub import HfApi, Repository
|
| 7 |
from export import convert
|
| 8 |
+
from gradio_huggingfacehub_search import HuggingfaceHubSearch
|
| 9 |
|
| 10 |
|
| 11 |
DATASET_REPO_URL = "https://huggingface.co/datasets/optimum/exporters"
|
|
|
|
| 89 |
|
| 90 |
To export your model you need:
|
| 91 |
- A read-access token from [https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens).
|
| 92 |
+
- A Model ID from the Hub (for example: [distilbert-base-uncased-finetuned-sst-2-english](https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english))
|
| 93 |
|
| 94 |
|
| 95 |
That's it ! π₯
|
|
|
|
| 97 |
After the model conversion, we will open a PR against the source repo.
|
| 98 |
"""
|
| 99 |
|
| 100 |
+
interface = gr.Interface(
|
| 101 |
+
fn=export,
|
| 102 |
+
inputs=[
|
| 103 |
+
HuggingfaceHubSearch(
|
| 104 |
+
label="Hub Model ID",
|
| 105 |
+
placeholder="Search for model id on Huggingface",
|
| 106 |
+
search_type="model",
|
| 107 |
+
),
|
| 108 |
+
gr.Textbox(
|
| 109 |
+
max_lines=1,
|
| 110 |
+
label="Hugging Face token",
|
| 111 |
+
),
|
| 112 |
+
],
|
| 113 |
+
outputs=[
|
| 114 |
+
gr.Markdown(label="output"),
|
| 115 |
+
gr.Image(show_label=False),
|
| 116 |
+
],
|
| 117 |
+
submit_btn=gr.Button("Export"),
|
| 118 |
+
title=TITLE,
|
| 119 |
+
description=DESCRIPTION,
|
| 120 |
+
)
|
| 121 |
with gr.Blocks() as demo:
|
| 122 |
gr.HTML(TTILE_IMAGE)
|
| 123 |
gr.HTML(TITLE)
|
| 124 |
+
interface.render()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
demo.launch()
|