Create ui/gradio_ui.py
Browse files- ui/gradio_ui.py +18 -0
ui/gradio_ui.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ui/gradio_ui.py
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
from agents.nsfw_agent import NSFWMatchingAgent
|
| 5 |
+
|
| 6 |
+
agent = NSFWMatchingAgent()
|
| 7 |
+
|
| 8 |
+
def match_text_ui(text):
|
| 9 |
+
return agent.match(text)
|
| 10 |
+
|
| 11 |
+
demo = gr.Interface(
|
| 12 |
+
fn=match_text_ui,
|
| 13 |
+
inputs=gr.Textbox(placeholder="Enter NSFW-style prompt...", label="Your Input"),
|
| 14 |
+
outputs=gr.Textbox(label="Best Matching Description"),
|
| 15 |
+
title="NSFW Text Semantic Matcher",
|
| 16 |
+
description="Finds the most semantically similar NSFW description from multiple datasets.",
|
| 17 |
+
allow_flagging="never"
|
| 18 |
+
)
|