Spaces:
Paused
Paused
| #Script added by SPDraptor | |
| import spaces | |
| from typing import Optional | |
| # import subprocess | |
| # subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True) | |
| import torch | |
| print("cuda present = ",torch.cuda.is_available()) | |
| import os | |
| import sys | |
| import gradio as gr | |
| from PIL import Image | |
| import controlnetSD | |
| DESCRIPTION = "Welcome to Raptor APIs" | |
| css = """ | |
| #output { | |
| height: 500px; | |
| overflow: auto; | |
| border: 1px solid #ccc; | |
| } | |
| """ | |
| with gr.Blocks(css=css) as demo: | |
| gr.Markdown(DESCRIPTION) | |
| with gr.Tab(label="img_inpaint"): | |
| with gr.Row(): | |
| with gr.Column(): | |
| org_image = gr.Image(label="Input main Picture") | |
| mask = gr.Image(label="Input mask Picture") | |
| prompt = gr.Textbox(label="prompt") | |
| mask_btn = gr.Button(value="replace") | |
| with gr.Column(): | |
| output_img = gr.Image(label="edited_img") | |
| mask_btn.click(controlnetSD.mask_based_updating2,inputs=[org_image,mask,prompt],outputs=output_img,api_name="/masked_based_img_editing") | |
| demo.launch() |