File size: 734 Bytes
da750df |
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 |
import requests
import streamlit as st
def get_openai_response(input_text):
response=requests.post("http://localhost:8000/essay/invoke",
json={'input':{'topic':input_text}})
return response.json()['output']['content']
def get_ollama_response(input_text):
response=requests.post(
"http://localhost:8000/poem/invoke",
json={'input':{'topic':input_text}})
return response.json()['output']
## streamlit framework
st.title('Langchain Demo With LLAMA2 API')
input_text=st.text_input("Write an essay on")
input_text1=st.text_input("Write a poem on")
if input_text:
st.write(get_openai_response(input_text))
if input_text1:
st.write(get_ollama_response(input_text1))
|