formix commited on
Commit
ec1783f
0 Parent(s):
Files changed (4) hide show
  1. .gitignore +65 -0
  2. README.md +3 -0
  3. app.py +38 -0
  4. requirements.txt +57 -0
.gitignore ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.so
4
+ *.egg
5
+ *.egg-info
6
+ .eggs
7
+ dist/
8
+ build/
9
+ wheels/
10
+ pip-wheel-metadata/
11
+ *.manifest
12
+ *.spec
13
+ *.log
14
+ *.pot
15
+ *.pyc
16
+ *.pyo
17
+ *.pyd
18
+ *.sqlite3
19
+ *.sqlite
20
+ *.db
21
+ *.db-journal
22
+ *.csv
23
+ *.tsv
24
+ *.xlsx
25
+ *.xls
26
+ *.ipynb
27
+ .ipynb_checkpoints
28
+ htmlcov/
29
+ .tox/
30
+ .coverage
31
+ .coverage.*
32
+ .cache
33
+ nosetests.xml
34
+ coverage.xml
35
+ *.cover
36
+ *.py,cover
37
+ .hypothesis/
38
+ .pytest_cache/
39
+ cover/
40
+ *.orig
41
+ .scoverage/
42
+ *.class
43
+ *.gradle
44
+ .gradle/
45
+ build/
46
+ target/
47
+ tmp/
48
+ out/
49
+ release/
50
+ .idea/
51
+ .vscode/
52
+ __MACOSX/
53
+ *.iml
54
+ *.ipr
55
+ *.iws
56
+ *.bak
57
+ *.swp
58
+ *.swo
59
+ *.swn
60
+ .env
61
+ .env/
62
+ env/
63
+ venv/
64
+ venv/*
65
+ gradio_env
README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ ---
2
+ sdk: gradio
3
+ ---
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import replicate
3
+ import os
4
+
5
+ def generate_images(prompt, api_key, num_calls):
6
+ os.environ["REPLICATE_API_TOKEN"] = api_key
7
+ image_urls = []
8
+ for _ in range(int(num_calls)):
9
+ output = replicate.run(
10
+ "black-forest-labs/flux-pro",
11
+ input={
12
+ "steps": 40,
13
+ "prompt": prompt
14
+ }
15
+
16
+ )
17
+ image_urls.append(output)
18
+ return image_urls
19
+
20
+ with gr.Blocks() as demo:
21
+ gr.Markdown("# Replicate Image Generator")
22
+ gr.Markdown("Generate images using the Replicate API")
23
+
24
+ with gr.Row():
25
+ prompt = gr.Textbox(label="Prompt")
26
+ api_key = gr.Textbox(label="Replicate API Key", type="password")
27
+ num_calls = gr.Number(label="Number of Images", minimum=1, maximum=10, step=1, value=1)
28
+
29
+ generate_button = gr.Button("Generate Images")
30
+ output_gallery = gr.Gallery(label="Generated Images", columns=5, rows=2, height=400)
31
+
32
+ generate_button.click(
33
+ fn=generate_images,
34
+ inputs=[prompt, api_key, num_calls],
35
+ outputs=output_gallery
36
+ )
37
+
38
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.2.1
2
+ annotated-types==0.7.0
3
+ anyio==4.4.0
4
+ certifi==2024.7.4
5
+ charset-normalizer==3.3.2
6
+ click==8.1.7
7
+ contourpy==1.2.1
8
+ cycler==0.12.1
9
+ fastapi==0.112.1
10
+ ffmpy==0.4.0
11
+ filelock==3.15.4
12
+ fonttools==4.53.1
13
+ fsspec==2024.6.1
14
+ gradio==4.42.0
15
+ gradio_client==1.3.0
16
+ h11==0.14.0
17
+ httpcore==1.0.5
18
+ httpx==0.27.0
19
+ huggingface-hub==0.24.6
20
+ idna==3.8
21
+ importlib_resources==6.4.4
22
+ Jinja2==3.1.4
23
+ kiwisolver==1.4.5
24
+ markdown-it-py==3.0.0
25
+ MarkupSafe==2.1.5
26
+ matplotlib==3.9.2
27
+ mdurl==0.1.2
28
+ numpy==2.1.0
29
+ orjson==3.10.7
30
+ packaging==24.1
31
+ pandas==2.2.2
32
+ pillow==10.4.0
33
+ pydantic==2.8.2
34
+ pydantic_core==2.20.1
35
+ pydub==0.25.1
36
+ Pygments==2.18.0
37
+ pyparsing==3.1.2
38
+ python-dateutil==2.9.0.post0
39
+ python-multipart==0.0.9
40
+ pytz==2024.1
41
+ PyYAML==6.0.2
42
+ requests==2.32.3
43
+ rich==13.7.1
44
+ ruff==0.6.2
45
+ semantic-version==2.10.0
46
+ shellingham==1.5.4
47
+ six==1.16.0
48
+ sniffio==1.3.1
49
+ starlette==0.38.2
50
+ tomlkit==0.12.0
51
+ tqdm==4.66.5
52
+ typer==0.12.4
53
+ typing_extensions==4.12.2
54
+ tzdata==2024.1
55
+ urllib3==2.2.2
56
+ uvicorn==0.30.6
57
+ websockets==12.0