Skip to content

Commit

Permalink
Merge pull request #18 from doccano/enhancement/adjust-layout
Browse files Browse the repository at this point in the history
Update layout
  • Loading branch information
Hironsan authored Mar 24, 2023
2 parents 463bd54 + 13b4690 commit 18cd80f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 4 additions & 5 deletions doccano_mini/pages/01_Text_Classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@

st.header("Test")
col1, col2 = st.columns([3, 1])
text = col1.text_area(label="Please enter your text.", value="", height=300)
inputs = {"input": col1.text_area(label="Please enter your text.", value="", height=300)}

with col2:
llm = openai_model_form()

with st.expander("See your prompt"):
st.markdown(f"```\n{prompt.format(input=text)}\n```")
st.markdown(f"```\n{prompt.format(**inputs)}\n```")

if st.button("Predict"):
chain = LLMChain(llm=llm, prompt=prompt)
response = chain.run(text)
label = response.split(":")[1]
st.text(label)
response = chain.run(**inputs)
st.text(response)

chain.save("config.yaml")
display_download_button()
Expand Down
11 changes: 8 additions & 3 deletions doccano_mini/pages/09_Task_Free.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@
prompt = make_task_free_prompt(examples)
prompt = task_instruction_editor(prompt)

inputs = {column: st.text_input(f"Input for {column}:") for column in columns[:-1]}
st.header("Test")
col1, col2 = st.columns([3, 1])
inputs = {column: col1.text_area(label=f"Input for {column}:", value="", height=300) for column in columns[:-1]}

st.markdown(f"Your prompt\n```\n{prompt.format(**inputs)}\n```")
with col2:
llm = openai_model_form()

with st.expander("See your prompt"):
st.markdown(f"```\n{prompt.format(**inputs)}\n```")

llm = openai_model_form()
if st.button("Predict"):
chain = LLMChain(llm=llm, prompt=prompt)
response = chain.run(**inputs)
Expand Down

0 comments on commit 18cd80f

Please sign in to comment.