Spaces:
Sleeping
Sleeping
File size: 975 Bytes
2cab7b7 f405afd 012fb95 2cab7b7 f405afd 2cab7b7 f405afd 2cab7b7 f405afd 2cab7b7 012fb95 2cab7b7 f405afd 012fb95 f405afd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import threading
from api import app
import gradio as gr
import torch
import numpy as np
from diffusers import DiffusionPipeline
from transformers import pipeline
def run_fastapi():
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=7860)
# FastAPI را در یک رشته جداگانه اجرا کنید
threading.Thread(target=run_fastapi).start()
# ادامه کد Gradio همانطور که قبلا بوده
# تعریف مثال
example = [["sexy woman", True, 2, 398231747038484200, ""],
# بقیه مثالها
]
with gr.Interface(
fn=genie,
inputs=[input_text, details_checkbox, steps_slider, seed_slider, cuda_checkbox],
outputs=[output_image, output_text],
title="Stable Diffusion Turbo with GPT",
description="Type your text and lets create an image, check the box details if you want a creative picture",
examples=example,
) as iface:
iface.launch(inline=True, show_api=False, max_threads=200)
|