Spaces:
Runtime error
Runtime error
montyanderson
commited on
Commit
•
d49e1e5
1
Parent(s):
e1ec1e3
Update app.py
Browse files- .gitignore +1 -0
- app.py +22 -2
- requirements.txt +3 -1
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
venv
|
app.py
CHANGED
@@ -5,8 +5,10 @@ import time
|
|
5 |
import json
|
6 |
import base64
|
7 |
import os
|
8 |
-
from PIL import Image
|
9 |
from io import BytesIO
|
|
|
|
|
|
|
10 |
|
11 |
class Prodia:
|
12 |
def __init__(self, api_key, base=None):
|
@@ -98,6 +100,13 @@ def flip_text(prompt, negative_prompt, model, steps, sampler, cfg_scale, width,
|
|
98 |
|
99 |
return job["imageUrl"]
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
css = """
|
102 |
#generate {
|
103 |
height: 100%;
|
@@ -170,5 +179,16 @@ with gr.Blocks(css=css) as demo:
|
|
170 |
|
171 |
text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
|
172 |
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
demo.launch()
|
|
|
5 |
import json
|
6 |
import base64
|
7 |
import os
|
|
|
8 |
from io import BytesIO
|
9 |
+
import PIL
|
10 |
+
from PIL.ExifTags import TAGS
|
11 |
+
|
12 |
|
13 |
class Prodia:
|
14 |
def __init__(self, api_key, base=None):
|
|
|
100 |
|
101 |
return job["imageUrl"]
|
102 |
|
103 |
+
def get_exif_data(image):
|
104 |
+
print(image)
|
105 |
+
exif = image.getexif()
|
106 |
+
print(exif)
|
107 |
+
|
108 |
+
return image.info
|
109 |
+
|
110 |
css = """
|
111 |
#generate {
|
112 |
height: 100%;
|
|
|
179 |
|
180 |
text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
|
181 |
|
182 |
+
with gr.Tab("PNG Info"):
|
183 |
+
with gr.Row():
|
184 |
+
with gr.Column():
|
185 |
+
image_input = gr.Image(type="pil")
|
186 |
+
with gr.Column():
|
187 |
+
exif_button = gr.Button("Get input data")
|
188 |
+
exif_output = gr.Textbox(label="EXIF Data")
|
189 |
+
|
190 |
+
exif_button.click(get_exif_data, inputs=[image_input], outputs=exif_output)
|
191 |
+
|
192 |
+
|
193 |
+
demo.queue(concurrency_count=24)
|
194 |
demo.launch()
|
requirements.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
numpy
|
2 |
gradio
|
3 |
-
requests
|
|
|
|
|
|
1 |
numpy
|
2 |
gradio
|
3 |
+
requests
|
4 |
+
pillow
|
5 |
+
pyexif
|