File size: 569 Bytes
d794995
87d40ba
d794995
87d40ba
 
 
6288b1a
 
87d40ba
6288b1a
87d40ba
6288b1a
87d40ba
6288b1a
87d40ba
 
6288b1a
87d40ba
6288b1a
87d40ba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import streamlit as st
import requests

# Streamlit 页面设置
st.title('AI Model API Interface')
st.write('输入文本,获取模型预测结果。')

# 用户输入
user_input = st.text_area('请输入文本:')

if st.button('提交'):
    if user_input.strip():
        with st.spinner('正在预测...'):
            try:
                prediction = user_input + '123'
                st.success(f'预测结果: {prediction}')
            except Exception as e:
                st.error(f'请求失败: {e}')
    else:
        st.warning('请输入文本!')