Siyuan0730's picture
11
a6cdc36
import openai
import streamlit as st
openai.api_key = st.secrets['OPENAI_API_KEY']
example_output1 = '''
您好!以下是根据您的作文进行修改和改进后的范文,根据雅思官方评分标准进行评分和给出建议:
题目:The chart below shows changes in water levels of reservoirs in six cities in Australia between 2009 and 2010.
我的作文:The given bar chart illustrates the variations in water levels in reservoirs across six cities in Australia during the period from 2009 to 2010. The data is presented in terms of the percentage of water storage capacity.
In general, the water storage levels in most cities remained relatively stable between 2009 and 2010, with the exception of Gold Coast, which experienced a significant increase. Furthermore, Sydney was the only city that witnessed a noticeable decrease in its water levels over the two-year period.
Looking at the specific figures, the water storage capacity of Brisbane was almost fully utilized in 2010. Similarly, Melbourne, Perth, and Gold Coast had approximately 80% of their water storage capacity occupied during the same year. On the other hand, Sydney and Darwin had significantly lower water storage levels, with approximately 40% of their capacity being utilized.
When considering the rate of change, it is worth noting that Gold Coast showed the highest increase in water storage proportion, rising from 60% in 2009 to almost 80% in 2010. Melbourne, on the other hand, experienced only a slight increase, which allowed it to surpass Perth as Perth's water levels remained consistent throughout the two-year period.
评分和建议:
根据雅思官方评分标准,这篇修改后的作文可以达到雅思写作的9分水平。下面是对您原始作文中语法、句式结构和词汇的具体建议:
1. 语法:
- 将"Given is"改为"Given"。
- 将"water storage of six Australian cities"改为"water levels in reservoirs across six cities in Australia",使表达更准确。
- 将"all water storage"改为"the water storage levels in most cities"。
- 将"didn't changed"改为"remained"。
- 将"significant growth"改为"significant increase"。
- 将"the only saw"改为"was the only city that witnessed"。
2. 句式结构:
- 在第一段,可以使用更多的连接词来组织句子,例如:"Furthermore"和"with the exception of"。
- 在第二段,将"Brisbane almost fulfilled"改为"The water storage capacity of Brisbane was almost fully utilized",使表达更加清晰。
- 在第三段,将"The city of Sydney and Darwin contains significantly less"改为"Sydney and Darwin had significantly lower"。
- 在第四段,将"Regarding changing rate"改为"When considering the rate of change",使过渡更自然。
- 在第四段,将"The Gold Coast presented greatest increase in proportion water"改为"Gold Coast showed the highest increase in water storage proportion",使表达更加准确。
3. 词汇:
- 将"vault"改为"storage capacity",更加符合语境。
- 将"fulfillment"改为"utilized",使表达更准确。
希望这些修改和建议对您有所帮助!如果您有任何其他问题,请随时提问。祝您在雅思考试中取得好成绩!
'''
example_output2 = '''
我可以给您具体的建议和修改,以下是针对您的作文进行改进的建议,按照语法、词汇和表达的顺序罗列出来:
语法和句子结构的修改建议:
1. 确保使用正确的主谓一致和动词时态,例如:"Several changes are evident"。
2. 将句子展开,避免过多使用短语,例如: "The images provided illustrate the current layout..."
3. 使用并列连词来连接句子,使得文章更连贯,例如: "In the future, there will be an expansion in the number of gates, and this will lead to a doubling of the arrival and departure doors."
4. 使用定冠词 "the" 来指代特定的事物,例如: "the proposed redevelopment plan"。
词汇建议:
1. 替换一般的词汇以展示更高级的表达,例如:
- Manipulate -> changes
- Extra -> additional
- Arrival and departure doors -> arrival and departure terminals
- Worth noting -> noteworthy
- Cancelled -> replaced
- Hall -> terminal building
- Relocated -> moved
- Placed -> situated
- Designed -> specially designed
表达建议:
1. 使用更丰富的词汇和短语来描述计划和变化,例如:
- Expansion -> expansion and enlargement
- Convenient -> efficient and convenient
- Cozy -> cozy and inviting
- Evident -> readily apparent
- Modern -> state-of-the-art
修改后的范文:
The provided images readily illustrate the current layout of Southwest Airport and the ambitious plan for its forthcoming redevelopment. A number of significant changes will be implemented, resulting in a much-improved airport environment.
In the near future, an expansion and enlargement of the airport will allow for additional terminals, thereby leading to a doubling of the number of arrival and departure terminals. One noteworthy change is the replacement of the walkway among the gates with an efficient and convenient sky train line. Furthermore, an inviting shopping area will be situated adjacent to the security and passport control zone.
Turning to the rest of the blueprint, a specially designed terminal building will house a wide array of amenities, with various facilities moved below the passport control district. In the departure area to the left, a new bag-drop site will be situated, effectively replacing the current check-in center, which itself will be moved. Adjacent to it, a cozy and inviting café will be set up, providing travelers with a pleasant waiting area. The arrival area, which is currently unoccupied, will be transformed with the addition of a state-of-the-art café, an ATM machine, and a specially designed car-hire service.
Overall, the redevelopment plan envisions a more spacious, efficient, and modern airport, greatly enhancing the travel experience for all passengers.
希望这些修改建议能够帮助您进一步提升作文的质量。记得在写作时注重细节和准确性,同时运用多样的词汇和表达方式,这将有助于使您的作文更具吸引力和表现力。
'''
def get_completion_from_messages(messages, model="gpt-3.5-turbo", temperature=0):
response = openai.ChatCompletion.create(
model=model,
messages=messages,
temperature=temperature, # this is the degree of randomness of the model's output
)
# print(str(response.choices[0].message))
return response.choices[0].message["content"]
def generate_revise(title, content):
system_message = "你是一名优秀的AI雅思考官和语言学家,擅长修改学生的雅思考试作文"
user_message = f"""
你现在是雅思考官和一位经验丰富的语言学家。我将给你雅思作文的题目和我的作文。
请您一步一步按照要求给出你的批改意见:
step 1. 对我的作文给出结构上的建议、句式和语法的建议,以及词汇上的修改建议。尤其多给一些关于用词的建议。用顺序罗列出来
step 2. 根据你的建议,将我的作文修改成一篇9分的范文并输出。
please follow them step-by-step.
题目:【{title}
我的作文:「{content}
请现在开始你的修改。
"""
messages = [
{'role':'system',
'content': system_message},
{'role':'user',
'content': user_message},
]
response = get_completion_from_messages(messages)
return response
def app():
st.title('''雅思作文1分钟批改润色 v0.0.1''')
col1, col2 = st.columns(2)
with col1:
title = st.text_area('请输入作文题目:')
content = st.text_area('请输入待批改的作文内容:')
btn = st.button('提交')
with st.expander('评分效果示例1'):
st.markdown(example_output1)
with st.expander('评分效果示例2'):
st.markdown(example_output2)
with col2:
st.markdown('批改结果如下👇')
if btn:
revise = generate_revise(title, content)
st.markdown(revise)
st.markdown("""
<style>
.footer {
position: fixed;
bottom: 0;
left: 10px;
width: auto;
background-color: transparent;
text-align: right;
padding-right: 10px;
padding-bottom: 10px;
}
</style>
<div class="footer">Made with ❤️ by Siyuan</div>
""", unsafe_allow_html=True)
if __name__ == '__main__':
app()