Spanicin commited on
Commit
5d139d7
·
verified ·
1 Parent(s): 4448dda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -775,7 +775,7 @@ import spaces
775
  import logging
776
  import random
777
  import warnings
778
- import gradio as gr
779
  import os
780
  import shutil
781
  import subprocess
@@ -924,34 +924,34 @@ async def infer(input_image: UploadFile = File(...),
924
 
925
  return JSONResponse(content={"base64_image": base64_image})
926
 
927
- def run_gradio_app():
928
- with gr.Blocks() as app:
929
- gr.Markdown("## Image Upscaler using ControlNet")
930
 
931
- # Define the inputs and outputs
932
- input_image = gr.Image(type="pil", label="Input Image")
933
- upscale_factor = gr.Slider(minimum=1, maximum=8, step=1, label="Upscale Factor")
934
- seed = gr.Slider(minimum=0, maximum=100, step=1, label="Seed")
935
- num_inference_steps = gr.Slider(minimum=1, maximum=100, step=1, label="Inference Steps")
936
- controlnet_conditioning_scale = gr.Slider(minimum=0.0, maximum=1.0, step=0.1, label="ControlNet Conditioning Scale")
937
 
938
- output_base64 = gr.Textbox(label="Base64 String", interactive=False)
939
 
940
- # Create a button to trigger the processing
941
- submit_button = gr.Button("Upscale Image")
942
 
943
- # Define the function to run when the button is clicked
944
- submit_button.click(run_inference,
945
- inputs=[input_image, upscale_factor, seed, num_inference_steps, controlnet_conditioning_scale],
946
- outputs=[output_base64])
947
 
948
- app.launch()
949
 
950
  if __name__ == "__main__":
951
- # Run Gradio app in a separate thread
952
- import threading
953
- gradio_thread = threading.Thread(target=run_gradio_app)
954
- gradio_thread.start()
955
 
956
  # Start FastAPI server
957
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
775
  import logging
776
  import random
777
  import warnings
778
+ #import gradio as gr
779
  import os
780
  import shutil
781
  import subprocess
 
924
 
925
  return JSONResponse(content={"base64_image": base64_image})
926
 
927
+ # def run_gradio_app():
928
+ # with gr.Blocks() as app:
929
+ # gr.Markdown("## Image Upscaler using ControlNet")
930
 
931
+ # # Define the inputs and outputs
932
+ # input_image = gr.Image(type="pil", label="Input Image")
933
+ # upscale_factor = gr.Slider(minimum=1, maximum=8, step=1, label="Upscale Factor")
934
+ # seed = gr.Slider(minimum=0, maximum=100, step=1, label="Seed")
935
+ # num_inference_steps = gr.Slider(minimum=1, maximum=100, step=1, label="Inference Steps")
936
+ # controlnet_conditioning_scale = gr.Slider(minimum=0.0, maximum=1.0, step=0.1, label="ControlNet Conditioning Scale")
937
 
938
+ # output_base64 = gr.Textbox(label="Base64 String", interactive=False)
939
 
940
+ # # Create a button to trigger the processing
941
+ # submit_button = gr.Button("Upscale Image")
942
 
943
+ # # Define the function to run when the button is clicked
944
+ # submit_button.click(run_inference,
945
+ # inputs=[input_image, upscale_factor, seed, num_inference_steps, controlnet_conditioning_scale],
946
+ # outputs=[output_base64])
947
 
948
+ # app.launch()
949
 
950
  if __name__ == "__main__":
951
+ # # Run Gradio app in a separate thread
952
+ # import threading
953
+ # gradio_thread = threading.Thread(target=run_gradio_app)
954
+ # gradio_thread.start()
955
 
956
  # Start FastAPI server
957
  uvicorn.run(app, host="0.0.0.0", port=7860)