Spaces:
Build error
Build error
File size: 1,347 Bytes
d35b749 2083ded d35b749 2083ded d35b749 f6587a7 d35b749 |
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 29 30 31 32 |
# Write a streamlit graphviz python program that creates a graph with two boxes and a line between them. The first box should have an outline with this information: Source Sequence: Question{s1,s2,s3}, Context: {sx,sy,sz}, and Answer: {s1,s2,s3}. The second box should have: Target Sequence: The answer to the question given the context is yes.
# modify the example not to use filename
# Import required libraries
import streamlit as st
import graphviz as gv
# Function to create the Graphviz graph
def create_graph():
g = gv.Digraph('G', engine='dot', format='png')
# Create the first box
box1_label = 'Source Sequence: Question{s1,s2,s3}\nContext: {sx,sy,sz}\nAnswer: {s1,s2,s3}'
g.node('box1', label=box1_label, shape='box', style='rounded')
# Create the second box
box2_label = 'Target Sequence: The answer to the question given the context is yes.'
g.node('box2', label=box2_label, shape='box', style='rounded')
# Add the line connecting the two boxes
g.edge('box1', 'box2')
return g
# Create the graph
graph = create_graph()
# Streamlit app
st.title("In Context Learning - Prompt Targeting QA Pattern")
st.subheader("The Question / Answer pattern below can be used in concert with a LLM to do real time in context learning using general intelligence.")
st.graphviz_chart(graph)
|