import gradio as gr from PIL import Image, ImageDraw import requests from io import BytesIO import numpy as np # Load the image from the URL input_image_url = "https://raw.githubusercontent.com/xoghd1126/G4-finalproject/main/%EC%8A%AC%EB%9D%BC%EC%9D%B4%EB%93%9C1.PNG" response = requests.get(input_image_url) image = Image.open(BytesIO(response.content)) # Convert the image to a numpy array image_np = np.array(image) # URL of the output image output_image_url = "https://raw.githubusercontent.com/xoghd1126/G4-finalproject/main/%EC%8A%AC%EB%9D%BC%EC%9D%B4%EB%93%9C2.png" # Function to process the drawing (dummy processing) def process_drawing(drawing): # Fetch the output image response = requests.get(output_image_url) output_image = Image.open(BytesIO(response.content)) return output_image # Create Gradio interface def create_interface(): sketchpad = gr.Sketchpad(label="Draw lines to match items", type="numpy", value=image_np) interface = gr.Interface( fn=process_drawing, inputs=[sketchpad], outputs="image", # Correctly specify the output type as "image" title="Match the words with the appropriate verb tense" ) return interface # Create and launch the interface interface = create_interface() interface.launch()