Update app.py
Browse files
app.py
CHANGED
@@ -16,10 +16,13 @@ with gr.Blocks() as demo:
|
|
16 |
|
17 |
@gr.render(inputs=[search_in], triggers=[search_in.submit])
|
18 |
def get_interface_from_repo(repo_id: str, progress: gr.Progress = gr.Progress()):
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
23 |
|
24 |
|
25 |
if __name__ == "__main__":
|
|
|
16 |
|
17 |
@gr.render(inputs=[search_in], triggers=[search_in.submit])
|
18 |
def get_interface_from_repo(repo_id: str, progress: gr.Progress = gr.Progress()):
|
19 |
+
try:
|
20 |
+
progress(0.0, desc="Loading model")
|
21 |
+
pipe = pipeline(model=repo_id)
|
22 |
+
progress(1.0, desc="Model loaded")
|
23 |
+
gr.Interface.from_pipeline(pipe, flagging_mode="never")
|
24 |
+
except Exception as e:
|
25 |
+
gr.Markdown(f"This model is not supported. It might be too large or it does not work with Gradio. Try another model. Failed with expection: {e}")
|
26 |
|
27 |
|
28 |
if __name__ == "__main__":
|