This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| from utils import get_country_data_and_corr | |
| class WriteEssayAfterParsingUserQuery(dspy.Module): | |
| def __init__(self): | |
| super().__init__() | |
| self.country = dspy.Predict(ExtractCountry) | |
| self.essay_writer = dspy.ChainOfThought(EssayOnePass) | |
| def forward(self, question, constraint, persona): | |
| with dspy.settings.context(lm=qwen2): # Call QWEN2 for extracting country name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| from huggingface_hub import login | |
| from dotenv import load_dotenv | |
| load_dotenv("/notebooks/.env") | |
| import os | |
| os.environ["TOKENIZERS_PARALLELISM"] = "false" | |
| login(token=os.getenv("HUGGINGFACE_TOKEN")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| # this is run from /notebooks on paperspace | |
| from huggingface_hub import login | |
| from dotenv import load_dotenv | |
| load_dotenv("/notebooks/.env") | |
| import os | |
| os.environ["TOKENIZERS_PARALLELISM"]="false" | |
| login(token=os.getenv("HUGGINGFACE_TOKEN")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flair.embeddings import ( | |
| FlairEmbeddings, | |
| TransformerWordEmbeddings, | |
| StackedEmbeddings, | |
| ) | |
| from flair.data import Sentence | |
| from flair.embeddings import DocumentPoolEmbeddings | |
| from sklearn.metrics.pairwise import cosine_similarity | |
| # init Flair embeddings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import libraries | |
| import os | |
| import swat | |
| import pandas as pd | |
| import toml | |
| with open('/tmp/config.toml','r') as f: | |
| server_config = toml.load(f) | |
| cas_settings = server_config.get('cas35') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CarouselSlider( | |
| options: CarouselOptions( | |
| height: _deviceHeight * 0.1, | |
| viewportFraction: 1.0, | |
| autoPlay: true, | |
| enlargeCenterPage: true, | |
| aspectRatio: 2.0, | |
| onPageChanged: (index, reason) { | |
| setState(() { | |
| _current = index; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NetworkHelper { | |
| NetworkHelper(this.url); | |
| final String url; | |
| final Xml2Json xml2json = new Xml2Json(); | |
| Future getData() async { | |
| print(url); | |
| http.Response response = | |
| await http.get(url, headers: {'Accept': 'application/json'}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void updateUI(dynamic recommendationJSON) { | |
| setState(() { | |
| if (recommendationJSON == null) { | |
| recommendationText = ''; | |
| return; | |
| } | |
| recommendationText = | |
| recommendationJSON['events'][1]['event']['Recommendation']; | |
| print(recommendationText); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'networking.dart'; | |
| import '../constants/esp_settings.dart'; | |
| const esp_rec_model_url = | |
| '$hostname:$http_port/SASESP/events/Recommendation_Engine/cq1/Final_Recommendation'; | |
| class RecommendationModel { | |
| Future<dynamic> getRecommendation(String id) async { | |
| NetworkHelper networkHelper = | |
| NetworkHelper('$esp_rec_model_url?filter=in(cust_id,$id)'); |