Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def
|
4 |
-
if
|
5 |
-
return "No
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
return f"Uploaded repo IDs: {', '.join(repo_ids)}"
|
10 |
-
except Exception as e:
|
11 |
-
return f"Error reading file: {e}"
|
12 |
|
13 |
demo = gr.Interface(
|
14 |
-
fn=
|
15 |
-
inputs=gr.
|
16 |
outputs="text",
|
17 |
-
title="Repo ID
|
18 |
-
description="
|
19 |
)
|
20 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import re
|
3 |
|
4 |
+
def process_repo_input(text):
|
5 |
+
if not text:
|
6 |
+
return "No repo IDs provided."
|
7 |
+
# Split by newlines and commas, strip whitespace
|
8 |
+
repo_ids = [repo.strip() for repo in re.split(r'[\n,]+', text) if repo.strip()]
|
9 |
+
return f"Entered repo IDs: {', '.join(repo_ids)}"
|
|
|
|
|
|
|
10 |
|
11 |
demo = gr.Interface(
|
12 |
+
fn=process_repo_input,
|
13 |
+
inputs=gr.Textbox(label="Enter repo IDs (comma or newline separated)", lines=5, placeholder="repo1, repo2\nrepo3"),
|
14 |
outputs="text",
|
15 |
+
title="Repo ID Input",
|
16 |
+
description="Enter repo IDs separated by commas or new lines."
|
17 |
)
|
18 |
demo.launch()
|