ahxan97 commited on
Commit
601e2c7
1 Parent(s): c455aff

Upload 11 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ Sbert_saved_model filter=lfs diff=lfs merge=lfs -text
Autumn8_logo.jpg ADDED
How_to_win_friends.txt ADDED
The diff for this file is too large to render. See raw diff
 
Knowledge_base_models.csv ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Domain,Task,Explaination
2
+ CV,depth-estimation,"Depth estimation is the task of predicting depth of the objects present in an image. About Depth Estimation. Depth estimation models can be used to estimate the depth of different objects present in an image. Estimation of Volumetric Information
3
+ Depth estimation models are widely used to study volumetric formation of objects present inside an image. This is an important use case in the domain of computer graphics.
4
+ 3D Representation Depth estimation models can also be used to develop a 3D representation from a 2D image."
5
+ CV,image-classification,"Image classification is the task of assigning a label or class to an entire image. Images are expected to have only one class for each image. Image classification models take an image as input and return a prediction about which class the image belongs to. Use Cases
6
+ Image classification models can be used when we are not interested in specific instances of objects with location information or their shape.
7
+
8
+ Keyword Classification
9
+ Image classification models are used widely in stock photography to assign each image a keyword.
10
+
11
+ Image Search
12
+ Models trained in image classification can improve user experience by organizing and categorizing photo galleries on the phone or in the cloud, on multiple keywords or tags."
13
+ CV,image-segmentation,"Image Segmentation divides an image into segments where each pixel in the image is mapped to an object. This task has multiple variants such as instance segmentation, panoptic segmentation and semantic segmentation. Use Cases
14
+ Autonomous Driving
15
+ Segmentation models are used to identify road patterns such as lanes and obstacles for safer driving.
16
+
17
+ Background Removal
18
+ Image Segmentation models are used in cameras to erase the background of certain objects and apply filters to them.
19
+
20
+ Medical Imaging
21
+ Image Segmentation models are used to distinguish organs or tissues, improving medical imaging workflows. Models are used to segment dental instances, analyze X-Ray scans or even segment cells for pathological diagnosis. This dataset contains images of lungs of healthy patients and patients with COVID-19 segmented with masks. Another segmentation dataset contains segmented MRI data of the lower spine to analyze the effect of spaceflight simulation.
22
+
23
+ Task Variants
24
+ Semantic Segmentation
25
+ Semantic Segmentation is the task of segmenting parts of an image that belong to the same class. Semantic Segmentation models make predictions for each pixel and return the probabilities of the classes for each pixel. These models are evaluated on Mean Intersection Over Union (Mean IoU).
26
+
27
+ Instance Segmentation
28
+ Instance Segmentation is the variant of Image Segmentation where every distinct object is segmented, instead of one segment per class.
29
+
30
+ Panoptic Segmentation
31
+ Panoptic Segmentation is the Image Segmentation task that segments the image both by instance and by class, assigning each pixel a different instance of the class."
32
+ CV,image-to-image,"Image-to-image is the task of transforming a source image to match the characteristics of a target image or a target image domain. Any image manipulation and enhancement is possible with image to image models. Style transfer
33
+ One of the most popular use cases of image to image is the style transfer. Style transfer models can convert a regular photography into a painting in the style of a famous painter.
34
+
35
+ Task Variants
36
+ Image inpainting
37
+ Image inpainting is widely used during photography editing to remove unwanted objects, such as poles, wires or sensor dust.
38
+
39
+ Image colorization
40
+ Old, black and white images can be brought up to life using an image colorization model.
41
+
42
+ Super Resolution
43
+ Super resolution models increase the resolution of an image, allowing for higher quality viewing and printing."
44
+ CV,object-detection,"Object Detection models allow users to identify objects of certain defined classes. Object detection models receive an image as input and output the images with bounding boxes and labels on detected objects. Autonomous Driving
45
+ Object Detection is widely used in computer vision for autonomous driving. Self-driving cars use Object Detection models to detect pedestrians, bicycles, traffic lights and road signs to decide which step to take.
46
+
47
+ Object Tracking in Matches
48
+ Object Detection models are widely used in sports where the ball or a player is tracked for monitoring and refereeing during matches.
49
+
50
+ Image Search
51
+ Object Detection models are widely used in image search. Smartphones use Object Detection models to detect entities (such as specific places or objects) and allow the user to search for the entity on the Internet.
52
+
53
+ Object Counting
54
+ Object Detection models are used to count instances of objects in a given image, this can include counting the objects in warehouses or stores, or counting the number of visitors in a store. They are also used to manage crowds at events to prevent disasters."
55
+ CV,video-classification,"Video classification is the task of assigning a label or class to an entire video. Videos are expected to have only one class for each video. Video classification models take a video as input and return a prediction about which class the video belongs to. Activity Recognition
56
+ Video classification models are used to perform activity recognition which is useful for fitness applications. Activity recognition is also helpful for vision-impaired individuals especially when they're commuting.
57
+
58
+ Video Search
59
+ Models trained in video classification can improve user experience by organizing and categorizing video galleries on the phone or in the cloud, on multiple keywords or tags."
60
+ CV,unconditional-image-generation,"Unconditional image generation is the task of generating images with no condition in any context (like a prompt text or another image). Once trained, the model will create images that resemble its training data distribution. Unconditional image generation is the task of generating new images without any specific input. The main goal of this is to create novel, original images that are not based on existing images. This can be used for a variety of applications, such as creating new artistic images, improving image recognition algorithms, or generating photorealistic images for virtual reality environments.
61
+
62
+ Unconditional image generation models usually start with a seed that generates a random noise vector. The model will then use this vector to create an output image similar to the images used for training the model.
63
+
64
+ An example of unconditional image generation would be generating the image of a face on a model trained with the CelebA dataset or generating a butterfly on a model trained with the Smithsonian Butterflies dataset.
65
+
66
+ Generative adversarial networks and Diffusion are common architectures for this task.
67
+
68
+ Use Cases
69
+ Unconditional image generation can be used for a variety of applications.
70
+
71
+ Artistic Expression
72
+ Unconditional image generation can be used to create novel, original artwork that is not based on any existing images. This can be used to explore new creative possibilities and produce unique, imaginative images.
73
+
74
+ Data Augmentation
75
+ Unconditional image generation models can be used to generate new images to improve the performance of image recognition algorithms. This makes algorithms more robust and able to handle a broader range of images.
76
+
77
+ Virtual Reality
78
+ Unconditional image generation models can be used to create photorealistic images that can be used in virtual reality environments. This makes the VR experience more immersive and realistic.
79
+
80
+ Medical Imaging
81
+ Unconditional image generation models can generate new medical images, such as CT or MRI scans, that can be used to train and evaluate medical imaging algorithms. This can improve the accuracy and reliability of these algorithms.
82
+
83
+ Industrial Design
84
+ Unconditional image generation models can generate new designs for products, such as clothing or furniture, that are not based on any existing designs. This way, designers can explore new creative possibilities and produce unique, innovative designs."
85
+ CV,zero-shot-image-classification,"Zero shot image classification is the task of classifying previously unseen classes during training of a model. Zero-shot image classification is a computer vision task to classify images into one of several classes, without any prior training or knowledge of the classes.
86
+
87
+ Zero shot image classification works by transferring knowledge learnt during training of one model, to classify novel classes that was not present in the training data. So this is a variation of transfer learning. For instance, a model trained to differentiate cars from airplanes can be used to classify images of ships.
88
+
89
+ The data in this learning paradigm consists of
90
+
91
+ Seen data - images and their corresponding labels
92
+ Unseen data - only labels and no images
93
+ Auxiliary information - additional information given to the model during training connecting the unseen and seen data. This can be in the form of textual description or word embeddings.
94
+ Use Cases
95
+ Image Retrieval
96
+ Zero-shot learning resolves several challenges in image retrieval systems. For example, with the rapid growth of categories on the web, it is challenging to index images based on unseen categories. With zero-shot learning we can associate unseen categories to images by exploiting attributes to model the relationships among visual features and labels.
97
+
98
+ Action Recognition
99
+ Action recognition is the task of identifying when a person in an image/video is performing a given action from a set of actions. If all the possible actions are not known beforehand, conventional deep learning models fail. With zero-shot learning, for a given domain of a set of actions, we can create a mapping connecting low-level features and a semantic description of auxiliary data to classify unknown classes of actions."
100
+ NLP ,conversational,"Conversational response modelling is the task of generating conversational text that is relevant, coherent and knowledgable given a prompt. These models have applications in chatbots, and as a part of voice assistants Chatbot ??
101
+ Chatbots are used to have conversations instead of providing direct contact with a live human. They are used to provide customer service, sales, and can even be used to play games (see ELIZA from 1966 for one of the earliest examples).
102
+
103
+ Voice Assistants ???
104
+ Conversational response models are used as part of voice assistants to provide appropriate responses to voice based queries."
105
+ NLP ,fill-mask,"Masked language modeling is the task of masking some of the words in a sentence and predicting which words should replace those masks. These models are useful when we want to get a statistical understanding of the language in which the model is trained in. Domain Adaptation ?????
106
+ Masked language models do not require labelled data! They are trained by masking a couple of words in sentences and the model is expected to guess the masked word. This makes it very practical!
107
+
108
+ For example, masked language modeling is used to train large models for domain-specific problems. If you have to work on a domain-specific task, such as retrieving information from medical research papers, you can train a masked language model using those papers. ??
109
+
110
+ The resulting model has a statistical understanding of the language used in medical research papers, and can be further trained in a process called fine-tuning to solve different tasks, such as Text Classification or Question Answering to build a medical research papers information extraction system. ????? Pre-training on domain-specific data tends to yield better results (see this paper for an example).
111
+
112
+ If you don't have the data to train a masked language model, you can also use an existing domain-specific masked language model from the Hub and fine-tune it with your smaller task dataset. That's the magic of Open Source and sharing your work! ??"
113
+ NLP ,question-answering,"Question Answering models can retrieve the answer to a question from a given text, which is useful for searching for an answer in a document. Some question answering models can generate answers without context! Frequently Asked Questions
114
+ You can use Question Answering (QA) models to automate the response to frequently asked questions by using a knowledge base (documents) as context. Answers to customer questions can be drawn from those documents.
115
+
116
+ ?? If you�d like to save inference time, you can first use passage ranking models to see which document might contain the answer to the question and iterate over that document with the QA model instead.
117
+
118
+ Task Variants
119
+ There are different QA variants based on the inputs and outputs:
120
+
121
+ Extractive QA: The model extracts the answer from a context. The context here could be a provided text, a table or even HTML! This is usually solved with BERT-like models.
122
+ Open Generative QA: The model generates free text directly based on the context. You can learn more about the Text Generation task in its page.
123
+ Closed Generative QA: In this case, no context is provided. The answer is completely generated by a model.
124
+ The schema above illustrates extractive, open book QA. The model takes a context and the question and extracts the answer from the given context.
125
+
126
+ You can also differentiate QA models depending on whether they are open-domain or closed-domain. Open-domain models are not restricted to a specific domain, while closed-domain models are restricted to a specific domain (e.g. legal, medical documents)."
127
+ NLP ,sentence-similarity,"Sentence Similarity is the task of determining how similar two texts are. Sentence similarity models convert input texts into vectors (embeddings) that capture semantic information and calculate how close (similar) they are between them. This task is particularly useful for information retrieval and clustering/grouping. Information Retrieval
128
+ You can extract information from documents using Sentence Similarity models. The first step is to rank documents using Passage Ranking models. You can then get to the top ranked document and search it with Sentence Similarity models by selecting the sentence that has the most similarity to the input query.
129
+
130
+ The Sentence Transformers library
131
+ The Sentence Transformers library is very powerful for calculating embeddings of sentences, paragraphs, and entire documents. An embedding is just a vector representation of a text and is useful for finding how similar two texts are.
132
+
133
+ You can find and use hundreds of Sentence Transformers models from the Hub by directly using the library, playing with the widgets in the browser or using the Inference API.
134
+
135
+ Task Variants
136
+ Passage Ranking
137
+ Passage Ranking is the task of ranking documents based on their relevance to a given query. The task is evaluated on Mean Reciprocal Rank. These models take one query and multiple documents and return ranked documents according to the relevancy to the query."
138
+ NLP ,summarization,"Summarization is the task of producing a shorter version of a document while preserving its important information. Some models can extract text from the original input, while other models can generate entirely new text. Research papers can be summarized to allow researchers to spend less time selecting which articles to read. There are several approaches you can take for a task like this:
139
+
140
+ Use an existing extractive summarization model on the Hub to do inference.
141
+ Pick an existing language model trained for academic papers. This model can then be trained in a process called fine-tuning so it can solve the summarization task.
142
+ Use a sequence-to-sequence model like T5 for abstractive text summarization."
143
+ NLP ,table-question-answering,"Table Question Answering (Table QA) is the answering a question about an information on a given table. SQL execution
144
+ You can use the Table Question Answering models to simulate SQL execution by inputting a table.
145
+
146
+ Table Question Answering
147
+ Table Question Answering models are capable of answering questions based on a table.
148
+
149
+ Task Variants
150
+ This place can be filled with variants of this task if there's any."
151
+ NLP ,text-classification,"Text Classification is the task of assigning a label or class to a given text. Some use cases are sentiment analysis, natural language inference, and assessing grammatical correctness. Sentiment Analysis on Customer Reviews
152
+ You can track the sentiments of your customers from the product reviews using sentiment analysis models. This can help understand churn and retention by grouping reviews by sentiment, to later analyze the text and make strategic decisions based on this knowledge.
153
+
154
+ Task Variants
155
+ Natural Language Inference (NLI)
156
+ In NLI the model determines the relationship between two given texts. Concretely, the model takes a premise and a hypothesis and returns a class that can either be:
157
+
158
+ entailment, which means the hypothesis is true.
159
+ contraction, which means the hypothesis is false.
160
+ neutral, which means there's no relation between the hypothesis and the premise.
161
+ The benchmark dataset for this task is GLUE (General Language Understanding Evaluation). NLI models have different variants, such as Multi-Genre NLI, Question NLI and Winograd NLI."
162
+ NLP ,text-generation,"Generating text is the task of producing new text. These models can, for example, fill in incomplete text or paraphrase. This task covers guides on both text-generation and text-to-text generation models. Popular large language models that are used for chats or following instructions are also covered in this task. You can find the list of selected open-source large language models here, ranked by their performance scores.
163
+
164
+ Use Cases
165
+ Instruction Models
166
+ A model trained for text generation can be later adapted to follow instructions. One of the most used open-source models for instruction is OpenAssistant, which you can try at Hugging Chat.
167
+
168
+ Code Generation
169
+ A Text Generation model, also known as a causal language model, can be trained on code from scratch to help the programmers in their repetitive coding tasks. One of the most popular open-source models for code generation is StarCoder, which can generate code in 80+ languages. You can try it here.
170
+
171
+ Stories Generation
172
+ A story generation model can receive an input like ""Once upon a time"" and proceed to create a story-like text based on those first words. You can try this application which contains a model trained on story generation, by MosaicML.
173
+
174
+ If your generative model training data is different than your use case, you can train a causal language model from scratch. Learn how to do it in the free transformers course!
175
+
176
+ Task Variants
177
+ Completion Generation Models
178
+ A popular variant of Text Generation models predicts the next word given a bunch of words. Word by word a longer text is formed that results in for example:
179
+
180
+ Given an incomplete sentence, complete it.
181
+ Continue a story given the first sentences.
182
+ Provided a code description, generate the code.
183
+ The most popular models for this task are GPT-based models (such as GPT-2). These models are trained on data that has no labels, so you just need plain text to train your own model. You can train GPT models to generate a wide variety of documents, from code to stories.
184
+
185
+ Text-to-Text Generation Models
186
+ These models are trained to learn the mapping between a pair of texts (e.g. translation from one language to another). The most popular variants of these models are T5, T0 and BART. Text-to-Text models are trained with multi-tasking capabilities, they can accomplish a wide range of tasks, including summarization, translation, and text classification."
187
+ NLP ,token-classification,"Token classification is a natural language understanding task in which a label is assigned to some tokens in a text. Some popular token classification subtasks are Named Entity Recognition (NER) and Part-of-Speech (PoS) tagging. NER models could be trained to identify specific entities in a text, such as dates, individuals and places; and PoS tagging would identify, for example, which words in a text are verbs, nouns, and punctuation marks. Information Extraction from Invoices
188
+ You can extract entities of interest from invoices automatically using Named Entity Recognition (NER) models. Invoices can be read with Optical Character Recognition models and the output can be used to do inference with NER models. In this way, important information such as date, company name, and other named entities can be extracted.
189
+
190
+ Task Variants
191
+ Named Entity Recognition (NER)
192
+ NER is the task of recognizing named entities in a text. These entities can be the names of people, locations, or organizations. The task is formulated as labeling each token with a class for each named entity and a class named ""0"" for tokens that do not contain any entities. The input for this task is text and the output is the annotated text with named entities."
193
+ NLP ,translation,"Translation is the task of converting text from one language to another. You can find over a thousand Translation models on the Hub, but sometimes you might not find a model for the language pair you are interested in. When this happen, you can use a pretrained multilingual Translation model like mBART and further train it on your own data in a process called fine-tuning.
194
+
195
+ Multilingual conversational agents
196
+ Translation models can be used to build conversational agents across different languages. This can be done in two ways.
197
+
198
+ Translate the dataset to a new language. You can translate a dataset of intents (inputs) and responses to the target language. You can then train a new intent classification model with this new dataset. This allows you to proofread responses in the target language and have better control of the chatbot's outputs.
199
+ Translate the input and output of the agent. You can use a Translation model in user inputs so that the chatbot can process it. You can then translate the output of the chatbot into the language of the user. This approach might be less reliable as the chatbot will generate responses that were not defined before."
200
+ NLP ,zero-shot-classification,"Zero-shot text classification is a task in natural language processing where a model is trained on a set of labeled examples but is then able to classify new examples from previously unseen classes. Zero Shot Classification is the task of predicting a class that wasn't seen by the model during training. This method, which leverages a pre-trained language model, can be thought of as an instance of transfer learning which generally refers to using a model trained for one task in a different application than what it was originally trained for. This is particularly useful for situations where the amount of labeled data is small.
201
+
202
+ In zero shot classification, we provide the model with a prompt and a sequence of text that describes what we want our model to do, in natural language. Zero-shot classification excludes any examples of the desired task being completed. This differs from single or few-shot classification, as these tasks include a single or a few examples of the selected task.
203
+
204
+ Zero, single and few-shot classification seem to be an emergent feature of large language models. This feature seems to come about around model sizes of +100M parameters. The effectiveness of a model at a zero, single or few-shot task seems to scale with model size, meaning that larger models (models with more trainable parameters or layers) generally do better at this task.
205
+
206
+ Here is an example of a zero-shot prompt for classifying the sentiment of a sequence of text:
207
+
208
+ Classify the following input text into one of the following three categories: [positive, negative, neutral]
209
+
210
+ Input Text: Hugging Face is awesome for making all of these
211
+ state of the art models available!
212
+ Sentiment: positive
213
+
214
+ One great example of this task with a nice off-the-shelf model is available at the widget of this page, where the user can input a sequence of text and candidate labels to the model. This is a word level example of zero shot classification, more elaborate and lengthy generations are available with larger models. Testing these models out and getting a feel for prompt engineering is the best way to learn how to use them."
Sbert_saved_model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c325983eeff065f15b7b0f9be84a199642c514ec220984d782acbf7b99fdee3
3
+ size 438123685
Top_3_models.csv ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Domain,Category,Model_1,Model_2,Model_3
2
+ CV,depth-estimation,Intel/dpt-large,ChristianOrr/madnet_keras,vinvino02/glpn-nyu
3
+ CV,image-classification,google/vit-base-patch16-224,cafeai/cafe_aesthetic,facebook/convnext-large-224
4
+ CV,image-segmentation,stabilityai/stable-diffusion-2-1,prompthero/openjourney,databricks/dolly-v2-12b
5
+ CV,image-to-image,timbrooks/instruct-pix2pix,CrucibleAI/ControlNetMediaPipeFace,lambdalabs/sd-image-variations-diffusers
6
+ CV,object-detection,keremberke/yolov8m-table-extraction,microsoft/table-transformer-detection,google/owlvit-base-patch32
7
+ CV,video-classification,microsoft/xclip-base-patch32,facebook/timesformer-base-finetuned-k400,MCG-NJU/videomae-base
8
+ CV,unconditional-image-generation,CompVis/ldm-celebahq-256,google/ddpm-cifar10-32,google/ddpm-celebahq-256
9
+ CV,zero-shot-image-classification,openai/clip-vit-base-patch32,yuvalkirstain/PickScore_v1,kakaobrain/align-base
10
+ NLP,conversational,PygmalionAI/pygmalion-6b,eachadea/legacy-ggml-vicuna-13b-4bit,facebook/blenderbot-3B
11
+ NLP,fill-mask,microsoft/deberta-v3-base,bert-base-uncased,roberta-large
12
+ NLP,question-answering,deepset/roberta-base-squad2,bert-large-uncased-whole-word-masking-finetuned-squad,deepset/deberta-v3-base-squad2
13
+ NLP,sentence-similarity,sentence-transformers/all-MiniLM-L6-v2,hkunlp/instructor-large,clips/mfaq
14
+ NLP,summarization,facebook/bart-large-cnn,tuner007/pegasus_summarizer,sshleifer/distilbart-cnn-12-6
15
+ NLP,table-question-answering,google/tapas-base-finetuned-wtq,microsoft/tapex-large-finetuned-wikisql,neulab/omnitab-large-finetuned-wtq
16
+ NLP,text-classification,distilbert-base-uncased-finetuned-sst-2-english,roberta-large-mnli,cardiffnlp/twitter-roberta-base-sentiment-latest
17
+ NLP,text-generation,EleutherAI/gpt-j-6b,decapoda-research/llama-7b-hf,cerebras/Cerebras-GPT-13B
18
+ NLP,token-classification,dslim/bert-large-NER,elastic/distilbert-base-uncased-finetuned-conll03-english,dslim/bert-base-NER
19
+ NLP,translation,t5-large,facebook/nllb-200-distilled-1.3B,t5-base
20
+ NLP,zero-shot-classification,facebook/bart-large-mnli,vicgalle/xlm-roberta-large-xnli-anli,typeform/distilbert-base-uncased-mnli
app.py ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+ from transformers import TextClassificationPipeline
5
+ from transformers import AutoTokenizer
6
+ from transformers import pipeline
7
+ import evaluate
8
+ import gradio as gr
9
+ import torch
10
+ import random
11
+ from transformers.file_utils import is_tf_available, is_torch_available, is_torch_tpu_available
12
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, Trainer, TrainingArguments
13
+ from datasets import load_metric
14
+ from sklearn.model_selection import train_test_split
15
+ import pandas as pd
16
+ import numpy as np
17
+ import streamlit as st
18
+ from textblob import TextBlob
19
+ from streamlit_extras.switch_page_button import switch_page
20
+
21
+
22
+
23
+ def get_models(prompt):
24
+ #prompt = input("Enter your AI task idea:")
25
+ response = pipe(prompt)
26
+ print("AI Model Idea: ", prompt,"\n")
27
+
28
+ x = pd.json_normalize(response[0])
29
+ # x.nlargest(3,['score'])["label"].values
30
+ knowledge_base_tasks = ['depth-estimation', 'image-classification', 'image-segmentation',
31
+ 'image-to-image', 'object-detection', 'video-classification',
32
+ 'unconditional-image-generation', 'zero-shot-image-classification',
33
+ 'conversational', 'fill-mask', 'question-answering',
34
+ 'sentence-similarity', 'summarization', 'table-question-answering',
35
+ 'text-classification', 'text-generation', 'token-classification',
36
+ 'translation', 'zero-shot-classification']
37
+
38
+ temp = []
39
+ for label_code in x.nlargest(3,['score'])["label"].values:
40
+ temp.append(label_code[6:])
41
+ # temp
42
+
43
+ cat_to_model = {}
44
+ top_cats = []
45
+
46
+ for i in range(len(temp)):
47
+ print("Possible Category ",i+1," : ",knowledge_base_tasks[int(temp[i])])
48
+ print("Top three models for this category are:",models_list[models_list["pipeline_tag"] == knowledge_base_tasks[int(temp[i])]].nlargest(3,"downloads")["modelId"].values)
49
+ cat_to_model[knowledge_base_tasks[int(temp[i])]] = models_list[models_list["pipeline_tag"] == knowledge_base_tasks[int(temp[i])]].nlargest(3,"downloads")["modelId"].values
50
+ top_cats.append(knowledge_base_tasks[int(temp[i])])
51
+ # models_list[models_list["pipeline_tag"] == "image-classification"].nlargest(3,"downloads")["modelId"].values
52
+ print()
53
+ print("Returning category-models dictionary..")
54
+ return top_cats,cat_to_model
55
+
56
+
57
+
58
+ def get_top_3(prompt):
59
+ response = pipe(prompt)
60
+ x = pd.json_normalize(response[0])
61
+ temp = []
62
+ for label_code in x.nlargest(3,['score'])["label"].values:
63
+ temp.append(label_code[6:])
64
+ knowledge_base_tasks = ['depth-estimation', 'image-classification', 'image-segmentation',
65
+ 'image-to-image', 'object-detection', 'video-classification',
66
+ 'unconditional-image-generation', 'zero-shot-image-classification',
67
+ 'conversational', 'fill-mask', 'question-answering',
68
+ 'sentence-similarity', 'summarization', 'table-question-answering',
69
+ 'text-classification', 'text-generation', 'token-classification',
70
+ 'translation', 'zero-shot-classification']
71
+
72
+ top_cat = knowledge_base_tasks[int(temp[0])]
73
+
74
+
75
+ top_3_df = pd.read_csv("./Top_3_models.csv")
76
+ top_3 = []
77
+ for i in range(top_3_df.shape[0]):
78
+ if top_3_df["Category"].iloc[i] == top_cat:
79
+ top_3.append(top_3_df["Model_1"].iloc[i])
80
+ top_3.append(top_3_df["Model_2"].iloc[i])
81
+ top_3.append(top_3_df["Model_3"].iloc[i])
82
+ break
83
+ return top_cat,top_3
84
+ def summarizer (models, data):
85
+ model_Eval = {}
86
+ for i in range (len(models)):
87
+ # print(models[i])
88
+ summarizer_model = pipeline("summarization", model = models[i])
89
+ print(summarizer_model(data))
90
+ try:
91
+ print(summarizer_model(data))
92
+ result = summarizer_model(data)[0]["summary_text"]
93
+ print("123",result)
94
+ rouge = evaluate.load('rouge')
95
+ # print("345",rouge.compute(predictions=[result],references=[data]))
96
+ quality = rouge.compute(predictions=[result],references=[data])
97
+ model_Eval[models[i]] = {"Score":quality,"Result": result}
98
+ except:
99
+ print("Model {} has issues.".format(models[i]))
100
+
101
+ return model_Eval
102
+
103
+
104
+
105
+ def best_model (analysis, data):
106
+ print("BESTTTTTTTTTTTTTTTTTTTTT")
107
+ print(analysis)
108
+ best_model_score = 0
109
+ best_model_name = ""
110
+ best_model_result = ""
111
+ temp2 = 0
112
+ for model in analysis.keys():
113
+ temp1 = analysis[model]["Score"]["rougeLsum"]
114
+ if temp1 > temp2:
115
+ temp2 = analysis[model]["Score"]["rougeLsum"]
116
+ best_model_score = analysis[model]["Score"]
117
+ best_model_name = model
118
+ best_model_result = analysis[model]["Result"]
119
+
120
+
121
+
122
+ return top_cats[0], best_model_name, best_model_score,data[:500],best_model_result.replace("\n","")
123
+
124
+
125
+ st.image("./Autumn8_logo.jpg")
126
+
127
+ # st.title("Text Analysis App")
128
+
129
+ data = ""
130
+
131
+
132
+ st.markdown(f'<p style="color: #36454F;font-size:36px;border-radius:%;">{"Please enter your task:"}</p>', unsafe_allow_html=True)
133
+
134
+ prompt = st.text_input(" ")
135
+
136
+
137
+
138
+ if prompt != "":
139
+ sbert_saved_model = torch.load("Sbert_saved_model")
140
+ model = sbert_saved_model.to("cpu")
141
+ tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/all-mpnet-base-v2")
142
+ pipe = TextClassificationPipeline(model= model, tokenizer=tokenizer, return_all_scores=True)
143
+ # outputs a list of dicts like [[{'label': 'NEGATIVE', 'score': 0.0001223755971295759}, {'label': 'POSITIVE', 'score': 0.9998776316642761}]]
144
+
145
+ # prompt = ["What is the the best ai for putting text report into data table?","How can I generate car sales agreement with ai model?","AI model to detect burglar on 48 hours of cctv video footage","I need Ai model help me with rewriting 50 financial statements emails into one summary report ?","I need a model for extracting person from an image"]
146
+ # responses = pipe(prompt)
147
+
148
+
149
+ models_list = pd.read_csv("models.csv")
150
+ # st.write(get_top_3(prompt))
151
+
152
+ top_cat, top_models = get_top_3(prompt)
153
+ # prompt = input("Enter your AI task idea:")
154
+ # top_cats,cat_to_models = get_models(prompt)
155
+
156
+ # top_models = cat_to_models[top_cats[0]]
157
+
158
+ top_cat = " " + top_cat[0].upper() + top_cat[1:]
159
+ st.markdown(f'<p style="color: #36454F;font-size:36px;border-radius:%;">{"Recommended AI Domain Type: "}</p>', unsafe_allow_html=True)
160
+
161
+ st.markdown(f'<p style="background-color:#0066cc; color:#FFFFFF;font-size:24px;border-radius:%;">{top_cat}</p>', unsafe_allow_html=True)
162
+ # st.write("Recommended AI Domain Type: ",top_cat)
163
+ # st.write("Recommended Models for category: ",top_cats[0], " are:",top_models)
164
+
165
+ # st.write("Recommended Task category: ",top_models[0])
166
+
167
+
168
+ st.markdown(f'<p style=" margin-left: 25px;color: #36454F;font-size:36px;border-radius:%;">{"Top 3 best models selected:"}</p>', unsafe_allow_html=True)
169
+
170
+
171
+ st.markdown(f'<p style="margin-left: 45px;background-color:#0066cc; color:#FFFFFF;font-size:24px;border-radius:%;">{"1- "+top_models[0]}</p>', unsafe_allow_html=True)
172
+
173
+
174
+ st.markdown(f'<p style="margin-left: 45px;background-color:#0066cc; color:#FFFFFF;font-size:24px;border-radius:%;">{"2- "+top_models[1]}</p>', unsafe_allow_html=True)
175
+
176
+
177
+ st.markdown(f'<p style="margin-left: 45px;background-color:#0066cc; color:#FFFFFF;font-size:24px;border-radius:%;">{"3- "+top_models[2]}</p>', unsafe_allow_html=True)
178
+
179
+
180
+ # st.write("Recommended Most Popular Model for category ",top_cat, " is:",top_models[0])
181
+ # if st.button("Show more"):
182
+ # for i in range(1,len(top_models)):
183
+ # st.write("Model#",str(i+1),top_models[i])
184
+
185
+
186
+ # data = prompt
187
+
188
+ # # print("before len data")
189
+
190
+ # if len(data) != 0:
191
+ # # print("after len data")
192
+ # st.write("Recommended Task category: ",top_cats[0])
193
+ # st.write("Recommended Most Popular Model for category ",top_cats[0], " is:",top_models[0])
194
+ # if st.button("Show more"):
195
+ # for i in range(1,len(top_models)):
196
+ # st.write("Model#",str(i+1),top_models[i])
197
+
198
+ # st.write("Upload your file: ")
199
+ # uploaded_files = ""
200
+ # uploaded_files = st.file_uploader("Choose a text file", accept_multiple_files=True)
201
+ # if st.button("Done"):
202
+ # global file_data
203
+ # st.write("filename:", uploaded_files)
204
+ # for uploaded_file in uploaded_files:
205
+ # # print("here")
206
+ # file_data = open(uploaded_file.name,encoding="utf8").read()
207
+ # st.write("filename:", uploaded_file.name)
208
+ # # st.write(file_data[:500])
209
+ # # print("before summarizer")
210
+ # print(file_data[:500])
211
+ # analysis = summarizer(models = top_models, data = file_data[:500])
212
+ # # print("between summarizer analysis")
213
+
214
+ # z,x,c,v,b = best_model(analysis,file_data[:500])
215
+ # st.write("Best model for Task: ",z)
216
+ # st.write("\nBest model name: ",x)
217
+ # st.write("\nBest model Score: ",c)
218
+ # st.write("\nOriginal Data first 500 characters: ", v)
219
+ # st.write("\nBest Model Result: ",b)
220
+ # st.success(result)
models.csv ADDED
The diff for this file is too large to render. See raw diff
 
models.json ADDED
The diff for this file is too large to render. See raw diff
 
prompts.csv ADDED
The diff for this file is too large to render. See raw diff
 
prompts_preds.csv ADDED
The diff for this file is too large to render. See raw diff
 
training dataset for app selector.xlsx ADDED
Binary file (123 kB). View file