Spaces:
Sleeping
Sleeping
File size: 1,664 Bytes
f60ef34 |
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# -*- coding: utf-8 -*-
"""app.ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1lKXL4Cdum5DiSbczUsadXc0F8j46NM_m
# in the name of **allah**
"""
import gradio as gr
from model import process_sentence, process_file # ایمپورت توابع پردازش از model.py
# تابع اصلی که ورودی متن و فایل را پردازش میکند
def analyze_text_and_file(input_text, file):
output_text = ""
if input_text:
output_text = process_sentence(input_text) # پردازش متن
file_output = None
if file:
file_output = process_file(file) # پردازش فایل
return output_text, file_output
# رابط کاربری Gradio
interface = gr.Interface(
fn=analyze_text_and_file,
inputs=[
gr.Textbox(lines=3, placeholder="Enter Persian text to process...", label="Text Input"),
gr.File(label="Upload CSV File"),
],
outputs=[
gr.Textbox(label="Processed Text"),
gr.HTML(label="File Processing Result"),
],
title="Persian Text Processor",
description="Process Persian text or upload a CSV file with a 'Comment' column.",
css="""
.gradio-container {
background-color: #000000;
color: #FFFFFF;
}
.gr-button {
background-color: #FF5733;
color: white;
}
.gr-textbox input {
background-color: #333333;
color: white;
}
.gr-button:hover {
background-color: #FF4500;
}
"""
)
interface.launch(share=True, debug=True, inline=False) |