Spaces:
Running
Running
philipp-zettl
commited on
Commit
•
7923b76
1
Parent(s):
6ffee07
first app draft
Browse files- .gitignore +3 -0
- app.py +28 -0
- poetry.lock +0 -0
- pyproject.toml +19 -0
- requirements.txt +56 -0
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
.venv/
|
2 |
+
tags
|
3 |
+
|
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from huggingface_hub import HfApi, ModelFilter, InferenceClient
|
3 |
+
|
4 |
+
if 'models' not in st.session_state:
|
5 |
+
|
6 |
+
hf_api = HfApi()
|
7 |
+
st.session_state.models = sorted(list(hf_api.list_models(
|
8 |
+
filter=ModelFilter(
|
9 |
+
task="text-to-image",
|
10 |
+
library="diffusers",
|
11 |
+
)
|
12 |
+
)), key=lambda x: x.downloads, reverse=True)
|
13 |
+
|
14 |
+
def format_model(model):
|
15 |
+
return f"{model.modelId} (⬇️ {model.downloads}, ❤️ {model.likes})"
|
16 |
+
|
17 |
+
|
18 |
+
st.title("Text to Image Model testing")
|
19 |
+
st.session_state.token = st.text_input("Enter your API token", type="password")
|
20 |
+
user_input = st.text_input("Your prompt")
|
21 |
+
model_name = st.selectbox("Select", st.session_state.models, format_func=format_model)
|
22 |
+
from diffusers import DiffusionPipeline
|
23 |
+
|
24 |
+
if model_name and user_input and st.session_state.token:
|
25 |
+
model_name = model_name.modelId
|
26 |
+
client = InferenceClient(model_name, token=st.session_state.token)
|
27 |
+
pred = client.text_to_image(user_input)
|
28 |
+
st.image(pred)
|
poetry.lock
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pyproject.toml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[tool.poetry]
|
2 |
+
name = "images"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = ""
|
5 |
+
authors = ["Philipp Zettl"]
|
6 |
+
readme = "README.md"
|
7 |
+
|
8 |
+
[tool.poetry.dependencies]
|
9 |
+
python = ">=3.10,<4.0"
|
10 |
+
streamlit = "^1.28.1"
|
11 |
+
requests = "^2.31.0"
|
12 |
+
huggingface-hub = "^0.17.0"
|
13 |
+
diffusers = "^0.22.1"
|
14 |
+
transformers = "^4.35.0"
|
15 |
+
|
16 |
+
|
17 |
+
[build-system]
|
18 |
+
requires = ["poetry-core"]
|
19 |
+
build-backend = "poetry.core.masonry.api"
|
requirements.txt
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
altair==5.1.2 ; python_version >= "3.10" and python_version < "4.0"
|
2 |
+
attrs==23.1.0 ; python_version >= "3.10" and python_version < "4.0"
|
3 |
+
blinker==1.7.0 ; python_version >= "3.10" and python_version < "4.0"
|
4 |
+
cachetools==5.3.2 ; python_version >= "3.10" and python_version < "4.0"
|
5 |
+
certifi==2023.7.22 ; python_version >= "3.10" and python_version < "4.0"
|
6 |
+
charset-normalizer==3.3.2 ; python_version >= "3.10" and python_version < "4.0"
|
7 |
+
click==8.1.7 ; python_version >= "3.10" and python_version < "4.0"
|
8 |
+
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
|
9 |
+
diffusers==0.22.1 ; python_version >= "3.10" and python_version < "4.0"
|
10 |
+
filelock==3.13.1 ; python_version >= "3.10" and python_version < "4.0"
|
11 |
+
fsspec==2023.10.0 ; python_version >= "3.10" and python_version < "4.0"
|
12 |
+
gitdb==4.0.11 ; python_version >= "3.10" and python_version < "4.0"
|
13 |
+
gitpython==3.1.40 ; python_version >= "3.10" and python_version < "4.0"
|
14 |
+
huggingface-hub==0.17.3 ; python_version >= "3.10" and python_version < "4.0"
|
15 |
+
idna==3.4 ; python_version >= "3.10" and python_version < "4.0"
|
16 |
+
importlib-metadata==6.8.0 ; python_version >= "3.10" and python_version < "4.0"
|
17 |
+
jinja2==3.1.2 ; python_version >= "3.10" and python_version < "4.0"
|
18 |
+
jsonschema-specifications==2023.7.1 ; python_version >= "3.10" and python_version < "4.0"
|
19 |
+
jsonschema==4.19.2 ; python_version >= "3.10" and python_version < "4.0"
|
20 |
+
markdown-it-py==3.0.0 ; python_version >= "3.10" and python_version < "4.0"
|
21 |
+
markupsafe==2.1.3 ; python_version >= "3.10" and python_version < "4.0"
|
22 |
+
mdurl==0.1.2 ; python_version >= "3.10" and python_version < "4.0"
|
23 |
+
numpy==1.25.2 ; python_version >= "3.10" and python_version < "4.0"
|
24 |
+
packaging==23.2 ; python_version >= "3.10" and python_version < "4.0"
|
25 |
+
pandas==2.1.2 ; python_version >= "3.10" and python_version < "4.0"
|
26 |
+
pillow==10.1.0 ; python_version >= "3.10" and python_version < "4.0"
|
27 |
+
protobuf==4.25.0 ; python_version >= "3.10" and python_version < "4.0"
|
28 |
+
pyarrow==14.0.0 ; python_version >= "3.10" and python_version < "4.0"
|
29 |
+
pydeck==0.8.0 ; python_version >= "3.10" and python_version < "4.0"
|
30 |
+
pygments==2.16.1 ; python_version >= "3.10" and python_version < "4.0"
|
31 |
+
python-dateutil==2.8.2 ; python_version >= "3.10" and python_version < "4.0"
|
32 |
+
pytz==2023.3.post1 ; python_version >= "3.10" and python_version < "4.0"
|
33 |
+
pyyaml==6.0.1 ; python_version >= "3.10" and python_version < "4.0"
|
34 |
+
referencing==0.30.2 ; python_version >= "3.10" and python_version < "4.0"
|
35 |
+
regex==2023.10.3 ; python_version >= "3.10" and python_version < "4.0"
|
36 |
+
requests==2.31.0 ; python_version >= "3.10" and python_version < "4.0"
|
37 |
+
rich==13.6.0 ; python_version >= "3.10" and python_version < "4.0"
|
38 |
+
rpds-py==0.12.0 ; python_version >= "3.10" and python_version < "4.0"
|
39 |
+
safetensors==0.4.0 ; python_version >= "3.10" and python_version < "4.0"
|
40 |
+
six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
|
41 |
+
smmap==5.0.1 ; python_version >= "3.10" and python_version < "4.0"
|
42 |
+
streamlit==1.28.1 ; python_version >= "3.10" and python_version < "4.0"
|
43 |
+
tenacity==8.2.3 ; python_version >= "3.10" and python_version < "4.0"
|
44 |
+
tokenizers==0.14.1 ; python_version >= "3.10" and python_version < "4.0"
|
45 |
+
toml==0.10.2 ; python_version >= "3.10" and python_version < "4.0"
|
46 |
+
toolz==0.12.0 ; python_version >= "3.10" and python_version < "4.0"
|
47 |
+
tornado==6.3.3 ; python_version >= "3.10" and python_version < "4.0"
|
48 |
+
tqdm==4.66.1 ; python_version >= "3.10" and python_version < "4.0"
|
49 |
+
transformers==4.35.0 ; python_version >= "3.10" and python_version < "4.0"
|
50 |
+
typing-extensions==4.8.0 ; python_version >= "3.10" and python_version < "4.0"
|
51 |
+
tzdata==2023.3 ; python_version >= "3.10" and python_version < "4.0"
|
52 |
+
tzlocal==5.2 ; python_version >= "3.10" and python_version < "4.0"
|
53 |
+
urllib3==2.0.7 ; python_version >= "3.10" and python_version < "4.0"
|
54 |
+
validators==0.22.0 ; python_version >= "3.10" and python_version < "4.0"
|
55 |
+
watchdog==3.0.0 ; python_version >= "3.10" and python_version < "4.0" and platform_system != "Darwin"
|
56 |
+
zipp==3.17.0 ; python_version >= "3.10" and python_version < "4.0"
|