Spaces:
Runtime error
Runtime error
Yuning Zhang commited on
Commit ·
c7c39a7
1
Parent(s): 1b58834
test drag
Browse files
app.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
-
# 创建一个可以拖拽上传文件的界面
|
| 10 |
demo = gr.Interface(
|
| 11 |
-
fn=
|
| 12 |
-
inputs=gr.
|
| 13 |
outputs="text"
|
| 14 |
)
|
| 15 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def process_files(files):
|
| 4 |
+
contents = []
|
| 5 |
+
for file in files:
|
| 6 |
+
with open(file.name, 'r') as f:
|
| 7 |
+
contents.append(f.read())
|
| 8 |
+
return "\n\n".join(contents)
|
| 9 |
|
|
|
|
| 10 |
demo = gr.Interface(
|
| 11 |
+
fn=process_files,
|
| 12 |
+
inputs=gr.File(label="拖拽文件到这里", type="file", file_count="multiple"),
|
| 13 |
outputs="text"
|
| 14 |
)
|
| 15 |
|