Spaces:
Runtime error
Runtime error
Create app_test.py
Browse files- app_test.py +27 -0
app_test.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from huggingface_hub import hf_hub_download
|
| 3 |
+
|
| 4 |
+
huggingface_hub.snapshot_download(
|
| 5 |
+
repo_id='h94/IP-Adapter',
|
| 6 |
+
allow_patterns=[
|
| 7 |
+
'models/**',
|
| 8 |
+
],
|
| 9 |
+
local_dir='models',
|
| 10 |
+
local_dir_use_symlinks=False,
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
import os
|
| 14 |
+
|
| 15 |
+
# specify the directory path
|
| 16 |
+
dir_path = 'models'
|
| 17 |
+
|
| 18 |
+
# list all files in the directory
|
| 19 |
+
files = os.listdir(dir_path)
|
| 20 |
+
|
| 21 |
+
# print the list of files
|
| 22 |
+
print(files)
|
| 23 |
+
|
| 24 |
+
def infer (text):
|
| 25 |
+
return text
|
| 26 |
+
|
| 27 |
+
gr.Interface(fn=infer, inputs=[gr.Textbox()], outputs=[gr.Textbox()]).launch()
|