Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ import asyncio
|
|
10 |
import aiohttp
|
11 |
import threading
|
12 |
|
|
|
13 |
app = FastAPI()
|
14 |
|
15 |
@app.get("/")
|
@@ -416,6 +417,24 @@ async def ask_website(url: str, question: str, model: str = "llama-3-70b", proxy
|
|
416 |
raise HTTPException(status_code=500, detail=f"Error fetching or processing URL: {e}")
|
417 |
except Exception as e:
|
418 |
raise HTTPException(status_code=500, detail=f"Error during question answering: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
|
420 |
@app.get("/api/maps")
|
421 |
async def maps(
|
|
|
10 |
import aiohttp
|
11 |
import threading
|
12 |
|
13 |
+
|
14 |
app = FastAPI()
|
15 |
|
16 |
@app.get("/")
|
|
|
417 |
raise HTTPException(status_code=500, detail=f"Error fetching or processing URL: {e}")
|
418 |
except Exception as e:
|
419 |
raise HTTPException(status_code=500, detail=f"Error during question answering: {e}")
|
420 |
+
|
421 |
+
from huggingface_hub import InferenceClient
|
422 |
+
client_sd3 = InferenceClient("stabilityai/stable-diffusion-3-medium-diffusers")
|
423 |
+
|
424 |
+
@app.get("/api/sd3")
|
425 |
+
def sd3(prompt :str = "",
|
426 |
+
steps: int = "20",
|
427 |
+
width: int = 1000,
|
428 |
+
height: int = 1000
|
429 |
+
):
|
430 |
+
try:
|
431 |
+
seed = random.randint(0, 9999999)
|
432 |
+
image = client_sd3.text_to_image(prompt = f"{prompt} , {seed}, hd, high quality, 4k, masterpiece",
|
433 |
+
num_inference_steps = steps,
|
434 |
+
width = width, height = height )
|
435 |
+
return image
|
436 |
+
except Exception as e:
|
437 |
+
raise HTTPException(detail=f"Error during image generation: {e}")
|
438 |
|
439 |
@app.get("/api/maps")
|
440 |
async def maps(
|