36 lines
2.0 KiB
Python
36 lines
2.0 KiB
Python
import gradio as gr
|
|
from simplet5 import SimpleT5
|
|
from gradio.themes.utils import sizes
|
|
theme = gr.themes.Default(radius_size=sizes.radius_none).set(
|
|
block_label_text_color = '#4D63FF',
|
|
block_title_text_color = '#4D63FF',
|
|
button_primary_text_color = '#4D63FF',
|
|
button_primary_background_fill='#FFFFFF',
|
|
button_primary_border_color='#4D63FF',
|
|
button_primary_background_fill_hover='#EDEFFF',
|
|
)
|
|
|
|
|
|
|
|
model = SimpleT5()
|
|
model.load_model("t5","snrspeaks/t5-one-line-summary")
|
|
|
|
def sentiment_analysis(text):
|
|
result = model.predict(text)
|
|
|
|
return result[0]
|
|
|
|
demo = gr.Interface(fn=sentiment_analysis,
|
|
inputs='text',
|
|
outputs='text',
|
|
examples=[["We describe a system called Overton, whose main design goal is to support engineers in building, monitoring, and improving production machinelearning systems. Key challenges engineers face are monitoring fine-grained quality, diagnosing errors in sophisticated applications, and handling contradictory or incomplete supervision data. Overton automates the life cycle of model construction, deployment, and monitoring by providing a set of novel high-level, declarative abstractions. Overton's vision is to shift developers to these higher-level tasks instead of lower-level machine learning tasks. In fact, using Overton, engineers can build deep-learning-based applications without writing any code in frameworks like TensorFlow. For over a year, Overton has been used in production to support multiple applications in both near-real-time applications and back-of-house processing. In that time, Overton-based applications have answered billions of queries in multiple languages and processed trillions of records reducing errors 1.7-2.9 times versus production systems."]],
|
|
theme = theme,
|
|
title = "摘要"
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# demo.queue(concurrency_count=3)
|
|
# demo.launch(server_name = "0.0.0.0", server_port = 7028)
|
|
demo.launch()
|