Spaces:
Sleeping
Sleeping
Commit
·
c5f58d3
1
Parent(s):
0e79306
Update main.py
Browse files
main.py
CHANGED
|
@@ -7,7 +7,7 @@ from gradio_client import Client
|
|
| 7 |
import base64
|
| 8 |
import requests
|
| 9 |
import os
|
| 10 |
-
import
|
| 11 |
|
| 12 |
app = FastAPI()
|
| 13 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
|
@@ -54,6 +54,10 @@ 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 |
@app.get("/Immagine")
|
| 58 |
def generate_image():
|
| 59 |
client = Client("https://openskyml-fast-sdxl-stable-diffusion-xl.hf.space/--replicas/545b5tw7n/")
|
|
@@ -67,7 +71,7 @@ def generate_image():
|
|
| 67 |
453666937,
|
| 68 |
fn_index=0
|
| 69 |
)
|
| 70 |
-
image_url =
|
| 71 |
return {"response": image_url}
|
| 72 |
|
| 73 |
@app.get("/Test")
|
|
|
|
| 7 |
import base64
|
| 8 |
import requests
|
| 9 |
import os
|
| 10 |
+
import socket
|
| 11 |
|
| 12 |
app = FastAPI()
|
| 13 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
|
|
|
| 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 |
453666937,
|
| 72 |
fn_index=0
|
| 73 |
)
|
| 74 |
+
image_url = get_ip_address() + result
|
| 75 |
return {"response": image_url}
|
| 76 |
|
| 77 |
@app.get("/Test")
|