Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,9 @@ from urllib.parse import quote
|
|
4 |
from huggingface_hub import InferenceClient
|
5 |
import numpy as np
|
6 |
import gradio as gr
|
7 |
-
|
|
|
|
|
8 |
def generate_img(prompt):
|
9 |
|
10 |
|
@@ -15,10 +17,19 @@ def pollinations_url_seedless(a, width=512, height=512):
|
|
15 |
url=f"https://image.pollinations.ai/prompt/{urlprompt}?width={width}&height={height}"
|
16 |
return url
|
17 |
|
|
|
|
|
|
|
|
|
18 |
def interrogate(img):
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
result
|
21 |
-
return result['generated_text']
|
22 |
def rountrip(img):
|
23 |
prompt=interrogate(img)
|
24 |
print(prompt)
|
|
|
4 |
from huggingface_hub import InferenceClient
|
5 |
import numpy as np
|
6 |
import gradio as gr
|
7 |
+
hfclient = InferenceClient()
|
8 |
+
grclient = Client("fancyfeast/joy-caption-alpha-two")
|
9 |
+
|
10 |
def generate_img(prompt):
|
11 |
|
12 |
|
|
|
17 |
url=f"https://image.pollinations.ai/prompt/{urlprompt}?width={width}&height={height}"
|
18 |
return url
|
19 |
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
def interrogate(img):
|
25 |
+
result = grclient.predict(
|
26 |
+
input_image=handle_file(img),
|
27 |
+
|
28 |
+
custom_prompt="Analyze this image like an art critic would with information about its composition, style, symbolism, the use of color, light, any artistic movement it might belong to, etc. Keep it very long.",
|
29 |
+
api_name="/stream_chat"
|
30 |
+
)
|
31 |
|
32 |
+
return result[1]
|
|
|
33 |
def rountrip(img):
|
34 |
prompt=interrogate(img)
|
35 |
print(prompt)
|