File size: 1,305 Bytes
05bd922
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
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()