import gradio as gr | |
from PIL import Image | |
from ImageProcess import classify_image | |
from generateText import create_funny_caption | |
def process_image(image): | |
print(f"image:{image}") | |
# 1) 이미지 분류 | |
label = classify_image(image) | |
# 2) chatGPT에게 만우절 밈 문구 요청 | |
caption = create_funny_caption(label) | |
return f"{caption}\n\n분석 라벨: {label}" | |
iface = gr.Interface( | |
fn=process_image, | |
inputs=gr.Image(type="pil"), | |
outputs="text", | |
title="AI 만우절 밈 생성기", | |
description="이미지를 업로드하면 AI가 분석하고, ChatGPT로부터 밈 문구를 생성합니다." | |
) | |
iface.launch() |