Spaces:
Sleeping
Sleeping
Commit
·
4caf2cc
1
Parent(s):
c5f58d3
Update main.py
Browse files
main.py
CHANGED
@@ -54,10 +54,6 @@ def read_root(request: Request, input_data: InputData):
|
|
54 |
generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
|
55 |
return {"response": generated_response}
|
56 |
|
57 |
-
def get_ip_address():
|
58 |
-
ip_address = socket.gethostbyname(socket.gethostname())
|
59 |
-
return ip_address
|
60 |
-
|
61 |
@app.get("/Immagine")
|
62 |
def generate_image():
|
63 |
client = Client("https://openskyml-fast-sdxl-stable-diffusion-xl.hf.space/--replicas/545b5tw7n/")
|
@@ -71,8 +67,11 @@ def generate_image():
|
|
71 |
453666937,
|
72 |
fn_index=0
|
73 |
)
|
74 |
-
image_url =
|
75 |
-
|
|
|
|
|
|
|
76 |
|
77 |
@app.get("/Test")
|
78 |
def generate_image():
|
|
|
54 |
generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
|
55 |
return {"response": generated_response}
|
56 |
|
|
|
|
|
|
|
|
|
57 |
@app.get("/Immagine")
|
58 |
def generate_image():
|
59 |
client = Client("https://openskyml-fast-sdxl-stable-diffusion-xl.hf.space/--replicas/545b5tw7n/")
|
|
|
67 |
453666937,
|
68 |
fn_index=0
|
69 |
)
|
70 |
+
image_url = result
|
71 |
+
with open(image_url, 'rb') as img_file:
|
72 |
+
img_binary = img_file.read()
|
73 |
+
img_base64 = base64.b64encode(img_binary).decode('utf-8')
|
74 |
+
return {"response": img_base64}
|
75 |
|
76 |
@app.get("/Test")
|
77 |
def generate_image():
|