Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
ollama_demo.py from langchain_ollama import ChatOllama import streamlit as st from langchain import PromptTemplate ai = ChatOllama(model="llama3:8b") prompt_template = PromptTemplate( input_variables={"country"}, template=''' You are an expert in traditional cuisines. you must provide information about a specific dish from a specific country. Answer the question: What is the traditional cuisine of the {country}? ''' ) st.title("Get Cuisine Information") country = st.text_input("Enter a country:") if country: response = ai.invoke(prompt_template.format(country=country)) st.write(response.content) prompt_template_demo.py from langchain_ollama import ChatOllama import streamlit as st from langchain_core.prompts import PromptTemplate from langchain.globals import set_debug set_debug(True) ai = ChatOllama(model="llama3:8b") prompt_template = PromptTemplate( input_variables={"country", "no_of_paras", "language"}, template=''' You are a world-renowned culinary expert specializing in traditional cuisines from around the globe. Your task is to describe the traditional cuisine of {country} in exactly {no_of_paras} paragraph(s). Each paragraph should be informative, culturally rich, and reflect authentic culinary practices or dishes from the region. Important constraints: - Write only in {language}. - Do not exceed or fall short of {no_of_paras} paragraph(s). - Focus on one or more iconic dishes, ingredients, cooking methods, or cultural significance. Begin your response now. ''' ) st.title("Get Cuisine Information") country = st.text_input("Enter a country:") no_of_paras = st.text_input("Enter number of paras:") language = st.text_input("Enter a language:") if country: response = ai.invoke(prompt_template.format(country=country, no_of_paras=no_of_paras, language=language)) st.write(response.content) single_chain.py from langchain_ollama import ChatOllama import streamlit as st from langchain_core.prompts import PromptTemplate from langchain.globals import set_debug set_debug(True) ai = ChatOllama(model="llama3:8b") prompt_template = PromptTemplate( input_variables={'country','month','budget'}, template=''' You are an expert travel guide. Now you must provide information about the place to visit in {country} during {month} with {budget} budget and the best local cuisine to try out. Make sure the place is must-visit attraction and good to visit during the month with specific budget and best local cuisine. Now give your response. ''' ) st.title("Travel Guide") country = st.text_input("Enter country name:") month = st.text_input("Enter month:") budget = st.selectbox( "What is your budget?", ("Low", "Medium", "High"), ) if country and month and budget: response = ai.invoke(prompt_template.format(country=country, month=month, budget=budget)) st.write(response.content) speech_generator.py from langchain_ollama import ChatOllama import streamlit as st from langchain_core.prompts import PromptTemplate from langchain.globals import set_debug set_debug(True) ai = ChatOllama(model="llama3:8b") title_template = PromptTemplate( input_variables={'topic'}, template=''' you are an experienced speech writer. you need to craft an impactful title for a speech on the following topic: {topic} answer exactly with one title ''' ) speech_template = PromptTemplate( input_variables={'title'}, template=''' you need to craft an powerful speech of 350 words for the following topic: {topic} ''' ) st.title("Speech Generator") topic = st.text_input("Enter topic:") first_chain = title_template | ai second_chain = speech_template | ai final_chain = first_chain | second_chain if topic: response = final_chain.invoke({'topic':topic}) st.write(response.content) travel_guide.py from langchain_ollama import ChatOllama import streamlit as st from langchain_core.prompts import PromptTemplate from langchain.globals import set_debug set_debug(True) ai = ChatOllama(model="llama3:8b") prompt_template = PromptTemplate( input_variables={'country','month','budget'}, template=''' You are an expert travel guide. Now you must provide information about the place to visit in {country} during {month} with {budget} budget and the best local cuisine to try out. Make sure the place is must-visit attraction and good to visit during the month with specific budget and best local cuisine. Now give your response. ''' ) st.title("Travel Guide") country = st.text_input("Enter country name:") month = st.text_input("Enter month:") budget = st.selectbox( "What is your budget?", ("Low", "Medium", "High"), ) chain = prompt_template | ai if country and month and budget: response = chain.invoke({'country':country, 'month':month, 'budget':budget}) st.write(response.content)
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)